Class: Shoulda::ActionController::Matchers::SetSessionMatcher
- Inherits:
-
Object
- Object
- Shoulda::ActionController::Matchers::SetSessionMatcher
- Defined in:
- lib/shoulda/action_controller/matchers/set_session_matcher.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(key) ⇒ SetSessionMatcher
constructor
A new instance of SetSessionMatcher.
- #matches?(controller) ⇒ Boolean
- #negative_failure_message ⇒ Object
- #to(value) ⇒ Object
Constructor Details
#initialize(key) ⇒ SetSessionMatcher
Returns a new instance of SetSessionMatcher.
18 19 20 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 18 def initialize(key) @key = key.to_s end |
Instance Method Details
#description ⇒ Object
40 41 42 43 44 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 40 def description description = "set session variable #{@key.inspect}" description << " to #{@value.inspect}" if defined?(@value) description end |
#failure_message ⇒ Object
32 33 34 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 32 def "Expected #{expectation}, but #{result}" end |
#matches?(controller) ⇒ Boolean
27 28 29 30 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 27 def matches?(controller) @controller = controller (assigned_value? && assigned_correct_value?) || cleared_value? end |
#negative_failure_message ⇒ Object
36 37 38 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 36 def "Didn't expect #{expectation}, but #{result}" end |
#to(value) ⇒ Object
22 23 24 25 |
# File 'lib/shoulda/action_controller/matchers/set_session_matcher.rb', line 22 def to(value) @value = value self end |