Class: RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher
- Inherits:
-
Object
- Object
- RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher
- Includes:
- Matchers::BaseMatcher
- Defined in:
- lib/rspec/rails/matchers/routing_matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object private
-
#initialize(scope, *expected) ⇒ RouteToMatcher
constructor
A new instance of RouteToMatcher.
- #matches?(verb_to_path_map) ⇒ Boolean private
Constructor Details
#initialize(scope, *expected) ⇒ RouteToMatcher
Returns a new instance of RouteToMatcher.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 8 def initialize(scope, *expected) @scope = scope @expected_options = expected[1] || {} if Hash === expected[0] @expected_options.merge!(expected[0]) else controller, action = expected[0].split('#') @expected_options.merge!(:controller => controller, :action => action) end end |
Instance Method Details
#failure_message_for_should ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 32 def rescued_exception. end |
#matches?(verb_to_path_map) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 20 def matches?(verb_to_path_map) match_unless_raises ActiveSupport::TestCase::Assertion do path, query = *verb_to_path_map.values.first.split('?') @scope.assert_recognizes( @expected_options, {:method => verb_to_path_map.keys.first, :path => path}, Rack::Utils::parse_query(query) ) end end |