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
Methods inherited from Matcher
#description_of, #failure_message_for_should, #failure_message_for_should_not, #values_match?
Constructor Details
#initialize(flash_key, controller) ⇒ SetFlashMatcher
Returns a new instance of SetFlashMatcher.
7 8 9 10 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 7 def initialize(flash_key, controller) @flash_key = flash_key @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
5 6 7 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 5 def controller @controller end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 5 def description @description end |
#expected_flash_value ⇒ Object (readonly)
Returns the value of attribute expected_flash_value.
4 5 6 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 4 def expected_flash_value @expected_flash_value end |
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
5 6 7 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 5 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly)
Returns the value of attribute failure_message_when_negated.
5 6 7 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 5 def @failure_message_when_negated end |
#flash_key ⇒ Object (readonly)
Returns the value of attribute flash_key.
4 5 6 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 4 def flash_key @flash_key end |
Instance Method Details
#matches?(actual) ⇒ Boolean
17 18 19 20 21 22 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 17 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
12 13 14 15 |
# File 'lib/warp/controller_matchers/set_flash_matcher.rb', line 12 def to(expected_flash_value) @expected_flash_value = expected_flash_value self end |