Methods
public class
public instance
Public class methods
new
(example)
[show source]
# File lib/spec/rails/matchers/route_to.rb, line 90 def initialize(example) @example = example end
Public instance methods
failure_message_for_should
()
[show source]
# File lib/spec/rails/matchers/route_to.rb, line 108 def failure_message_for_should "Expected '#{@actual.keys.first.to_s.upcase} #{@actual.values.first}' to be routable, but it wasn't.\n"+ "To really test routability, we recommend #{@actual.inspect}.\n"+ " should route_to( :action => 'action', :controller => 'controller' )\n\n"+ "That way, you'll verify where your route goes to. Plus, we'll verify\n"+ "the generation of the expected path from the action/controller, as in\n"+ "the url_for() helper." end
failure_message_for_should_not
()
[show source]
# File lib/spec/rails/matchers/route_to.rb, line 118 def failure_message_for_should_not "Expected '#{@actual.keys.first.to_s.upcase} #{@actual.values.first}' to fail, but it routed to #{@actual_place} instead" end
matches?
(path)
[show source]
# File lib/spec/rails/matchers/route_to.rb, line 94 def matches?(path) begin @actual = path method, path = PathDecomposer.decompose_path(path) @example.assert_recognizes({}, { :method => method, :path => path }, {} ) true rescue ActionController::RoutingError, ActionController::MethodNotAllowed false rescue ::Test::Unit::AssertionFailedError => e # the second thingy will always be "<{}>" becaues of the way we called assert_recognizes({}...) above. e.to_s =~ /<(.*)> did not match <\{\}>/ and @actual_place = $1 or raise true end end