Class: Shoulda::ActionController::Matchers::RouteMatcher
- Inherits:
-
Object
- Object
- Shoulda::ActionController::Matchers::RouteMatcher
- Defined in:
- lib/shoulda/action_controller/matchers/route_matcher.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#negative_failure_message ⇒ Object
readonly
Returns the value of attribute negative_failure_message.
Instance Method Summary collapse
- #description ⇒ Object
- #in_context(context) ⇒ Object
-
#initialize(method, path, context) ⇒ RouteMatcher
constructor
A new instance of RouteMatcher.
- #matches?(controller) ⇒ Boolean
- #to(params) ⇒ Object
Constructor Details
#initialize(method, path, context) ⇒ RouteMatcher
Returns a new instance of RouteMatcher.
31 32 33 34 35 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 31 def initialize(method, path, context) @method = method @path = path @context = context end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
54 55 56 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 54 def @failure_message end |
#negative_failure_message ⇒ Object (readonly)
Returns the value of attribute negative_failure_message.
54 55 56 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 54 def @negative_failure_message end |
Instance Method Details
#description ⇒ Object
56 57 58 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 56 def description "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" end |
#in_context(context) ⇒ Object
43 44 45 46 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 43 def in_context(context) @context = context self end |
#matches?(controller) ⇒ Boolean
48 49 50 51 52 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 48 def matches?(controller) @controller = controller guess_controller! route_recognized? end |
#to(params) ⇒ Object
37 38 39 40 41 |
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 37 def to(params) @params = params stringify_params! self end |