Class: Warp::ControllerMatchers::AssignMatcher
- Defined in:
- lib/warp/controller_matchers/assign_matcher.rb
Direct Known Subclasses
AssignWithAMatcher, AssignWithANewMatcher, AssignWithMatcher
Instance Attribute Summary collapse
-
#assign_key ⇒ Object
readonly
Returns the value of attribute assign_key.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(assign_key, controller) ⇒ AssignMatcher
constructor
A new instance of AssignMatcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(assign_key, controller) ⇒ AssignMatcher
Returns a new instance of AssignMatcher.
43 44 45 46 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 43 def initialize(assign_key, controller) @assign_key = assign_key @controller = controller end |
Instance Attribute Details
#assign_key ⇒ Object (readonly)
Returns the value of attribute assign_key.
41 42 43 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 41 def assign_key @assign_key end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
41 42 43 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 41 def controller @controller end |
Instance Method Details
#description ⇒ Object
53 54 55 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 53 def description "assign @#{assign_key}" end |
#failure_message ⇒ Object
57 58 59 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 57 def "expected @#{assign_key} to be assigned" end |
#failure_message_when_negated ⇒ Object
61 62 63 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 61 def "expected @#{assign_key} to not be assigned" end |
#matches?(actual) ⇒ Boolean
48 49 50 51 |
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 48 def matches?(actual) @controller = actual if actual.is_a?(ActionController::Metal) check_assign end |