[rspec-devel] [ rspec-Feature Requests-11834 ] Fake Controller Flash object

noreply at rubyforge.org noreply at rubyforge.org
Mon Nov 19 00:05:07 EST 2007


Feature Requests item #11834, was opened at 2007-06-25 13:06
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=11834&group_id=797

Category: rails plugin
Group: None
Status: Open
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: Fake Controller Flash object

Initial Comment:
Currently it is difficult to test the values on Flash.now, because the Flash.sweep is called during the process action.

We made a Fake Flash Hash object that collects the flash content and does not sweep it when the request is processed.


----------------------------------------------------------------------

Comment By: Chad Humphries (spicycode)
Date: 2007-11-19 00:05

Message:
Moved to http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/98-11834-fake-controller-flash-object#ticket-98-2

----------------------------------------------------------------------

Comment By: Brian Takita (btakita)
Date: 2007-06-27 02:38

Message:
Mainly, it was Nathan Wilmes who developed this. It is very
bare bones, and meant for primarily collecting value.

class MockFlashHash
  def initialize
    @hash = {}
    @now_hash = {}
  end

  def [](key)
    @hash[key]
  end

  def []=(key, obj)
    @hash[key] = obj
  end

  def discard(k = nil)
    initialize
  end

  def now
    @now_hash
  end

  def update(hash)
    @hash.update(hash)
  end

  def sweep
    # This is the key.  We don't really want flash.now's to
go away.
  end
end


----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-26 03:02

Message:
What does it look like?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=11834&group_id=797


More information about the rspec-devel mailing list