Class: RSpec::Rails::Matchers::RoutingMatchers::BeRoutableMatcher
- Inherits:
-
Matchers::BuiltIn::BaseMatcher
- Object
- Matchers::BuiltIn::BaseMatcher
- RSpec::Rails::Matchers::RoutingMatchers::BeRoutableMatcher
- Defined in:
- lib/rspec/rails/matchers/routing_matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(scope) ⇒ BeRoutableMatcher
constructor
A new instance of BeRoutableMatcher.
- #matches?(path) ⇒ Boolean private
Constructor Details
#initialize(scope) ⇒ BeRoutableMatcher
Returns a new instance of BeRoutableMatcher.
62 63 64 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 62 def initialize(scope) @scope = scope end |
Instance Method Details
#failure_message_for_should ⇒ Object
76 77 78 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 76 def "expected #{@actual.inspect} to be routable" end |
#failure_message_for_should_not ⇒ Object
80 81 82 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 80 def "expected #{@actual.inspect} not to be routable, but it routes to #{@routing_options.inspect}" end |
#matches?(path) ⇒ 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.
67 68 69 70 71 72 73 74 |
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 67 def matches?(path) @actual = path match_unless_raises ActionController::RoutingError do @routing_options = @scope.routes.recognize_path( path.values.first, :method => path.keys.first ) end end |