Sha256: a211454dda6a806d5c1789a8527f29d46dd57683b562a66235f44b36a9fb6868
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
require File.join(File.dirname(__FILE__), 'set_session_matcher') module Remarkable module ActionController module Matchers class SetTheFlashMatcher < SetSessionMatcher #:nodoc: protected def session @subject ? (@subject.response.session['flash'] || {}) : {} end def interpolation_options { :flash_inspect => session.symbolize_keys!.inspect } end end # Ensures that a session keys were set. If you want to check that a flash # is not being set, please do: # # should_not_set_the_flash(:user) # # If you want to assure that a flash is being set to nil, do instead: # # should_set_the_flash(:user).to(nil) # # == Options # # * <tt>:to</tt> - The value to compare the flash key. It accepts procs and can also be given as a block (see examples below) # # == Examples # # should_set_the_flash # should_not_set_the_flash # # should_set_the_flash :to => 'message' # should_set_the_flash :notice, :warn # should_set_the_flash :notice, :to => 'message' # should_set_the_flash :notice, :to => proc{ 'hi ' + users(:first).name } # should_set_the_flash(:notice){ 'hi ' + users(:first).name } # # it { should set_the_flash } # it { should set_the_flash.to('message') } # it { should set_the_flash(:notice, :warn) } # it { should set_the_flash(:notice, :to => 'message') } # it { should set_the_flash(:notice, :to => ('hi ' + users(:first).name)) } # def set_the_flash(*args, &block) SetTheFlashMatcher.new(*args, &block).spec(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems