Class: Shoulda::Matchers::ActionController::FlashStore
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::FlashStore
- Defined in:
- lib/shoulda/matchers/action_controller/flash_store.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
Class Method Summary collapse
Instance Method Summary collapse
- #has_key?(key) ⇒ Boolean
- #has_value?(expected_value) ⇒ Boolean
-
#initialize ⇒ FlashStore
constructor
A new instance of FlashStore.
- #name ⇒ Object
- #use_now! ⇒ Object
Constructor Details
#initialize ⇒ FlashStore
Returns a new instance of FlashStore.
17 18 19 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 17 def initialize @use_now = false end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
15 16 17 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 15 def controller @controller end |
Class Method Details
.future ⇒ Object
7 8 9 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 7 def self.future new end |
.now ⇒ Object
11 12 13 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 11 def self.now new.use_now! end |
Instance Method Details
#has_key?(key) ⇒ Boolean
29 30 31 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 29 def has_key?(key) values_to_check.include?(key.to_s) end |
#has_value?(expected_value) ⇒ Boolean
33 34 35 36 37 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 33 def has_value?(expected_value) values_to_check.values.any? do |actual_value| expected_value === actual_value end end |
#name ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 21 def name if @use_now 'flash.now' else 'flash' end end |
#use_now! ⇒ Object
40 41 42 43 |
# File 'lib/shoulda/matchers/action_controller/flash_store.rb', line 40 def use_now! @use_now = true self end |