class Shoulda::Matchers::ActionController::FlashStore
@private
Attributes
Public Class Methods
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 7 def self.future new end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 17 def initialize @use_now = false end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 11 def self.now new.use_now! end
Public Instance Methods
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 29 def has_key?(key) values_to_check.include?(key.to_s) end
Source
# 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
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 21 def name if @use_now 'flash.now' else 'flash' end end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 40 def use_now! @use_now = true self end
Private Instance Methods
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 63 def copy_discard_if_necessary(original_flash, new_flash) discard = original_flash.instance_variable_get('@discard').dup new_flash.instance_variable_set('@discard', discard) end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 58 def copy_flashes(original_flash, new_flash) flashes = original_flash.instance_variable_get('@flashes').dup new_flash.instance_variable_set('@flashes', flashes) end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 51 def copy_of_flash_from_controller controller.flash.dup.tap do |flash| copy_flashes(controller.flash, flash) copy_discard_if_necessary(controller.flash, flash) end end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 47 def flash @_flash ||= copy_of_flash_from_controller end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 72 def keys_to_discard flash.instance_variable_get('@discard') end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 68 def set_values flash.instance_variable_get('@flashes') end
Source
# File lib/shoulda/matchers/action_controller/flash_store.rb, line 76 def values_to_check if @use_now set_values.slice(*keys_to_discard.to_a) else set_values.except(*keys_to_discard.to_a) end end