Class: Warp::ControllerMatchers::SetFlashMatcher
- Defined in:
- lib/warp/controller_matchers/set_flash_matcher.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#expected_flash_value ⇒ Object
readonly
Returns the value of attribute expected_flash_value.
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#failure_message_when_negated ⇒ Object
readonly
Returns the value of attribute failure_message_when_negated.
-
#flash_key ⇒ Object
readonly
Returns the value of attribute flash_key.
Instance Method Summary collapse
-
#initialize(flash_key, controller) ⇒ SetFlashMatcher
constructor
A new instance of SetFlashMatcher.
- #matches?(actual) ⇒ Boolean
- #to(expected_flash_value) ⇒ Object
Constructor Details
#initialize(flash_key, controller) ⇒ SetFlashMatcher
Returns a new instance of SetFlashMatcher.
9 10 11 12 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 9 def initialize(flash_key, controller) @flash_key = flash_key @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
7 8 9 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 7 def controller @controller end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 7 def description @description end |
#expected_flash_value ⇒ Object (readonly)
Returns the value of attribute expected_flash_value.
6 7 8 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 6 def expected_flash_value @expected_flash_value end |
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
7 8 9 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 7 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly)
Returns the value of attribute failure_message_when_negated.
7 8 9 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 7 def @failure_message_when_negated end |
#flash_key ⇒ Object (readonly)
Returns the value of attribute flash_key.
6 7 8 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 6 def flash_key @flash_key end |
Instance Method Details
#matches?(actual) ⇒ Boolean
19 20 21 22 23 24 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 19 def matches?(actual) @controller = actual if actual.is_a?(ActionController::Metal) return check_expected_value if expected_flash_value return check_assigned end |
#to(expected_flash_value) ⇒ Object
14 15 16 17 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 14 def to(expected_flash_value) @expected_flash_value = expected_flash_value self end |