Class: Shoulda::Matchers::ActionController::SetFlashMatcher

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/shoulda/matchers/action_controller/set_flash_matcher.rb

Defined Under Namespace

Classes: QualifierOrderError

Instance Method Summary collapse

Constructor Details

#initializeSetFlashMatcher

Returns a new instance of SetFlashMatcher.



170
171
172
173
# File 'lib/shoulda/matchers/action_controller/set_flash_matcher.rb', line 170

def initialize
  store = FlashStore.future
  @underlying_matcher = SetSessionOrFlashMatcher.new(store)
end

Instance Method Details

#[](key) ⇒ Object



190
191
192
193
194
# File 'lib/shoulda/matchers/action_controller/set_flash_matcher.rb', line 190

def [](key)
  @key = key
  underlying_matcher[key]
  self
end

#in_context(context) ⇒ Object



185
186
187
188
# File 'lib/shoulda/matchers/action_controller/set_flash_matcher.rb', line 185

def in_context(context)
  underlying_matcher.in_context(context)
  self
end

#nowObject



175
176
177
178
179
180
181
182
183
# File 'lib/shoulda/matchers/action_controller/set_flash_matcher.rb', line 175

def now
  if key || expected_value
    raise QualifierOrderError
  end

  store = FlashStore.now
  @underlying_matcher = SetSessionOrFlashMatcher.new(store)
  self
end

#to(expected_value = nil, &block) ⇒ Object



196
197
198
199
200
# File 'lib/shoulda/matchers/action_controller/set_flash_matcher.rb', line 196

def to(expected_value = nil, &block)
  @expected_value = expected_value
  underlying_matcher.to(expected_value, &block)
  self
end