Testing the flash.now

What’s the best way to test the flash when you use flash#now ? For
example, if I set the flash in my controller:

flash.now[:notice] = ‘This will only show up on this action.’

How do I test it? Normally I would do:

assert_equal ‘This will only show up on this action.’, flash[:notice]

But this doesn’t seem to work with flash.now.

Any thoughts?


John L.
http://wiseheartdesign.com
http://radiantcms.org

Hello John,

2006/7/31, John W. Long [email protected]:

Any thoughts?

I have this problem in the FlashHelper plugin. The problem is that as
soon as the action ends, the Flash is cleared. You would have to call
flash.keep somewhere to ensure all keys are kept.

I tried extending the FlashHelper plugin to do that, but it took more
time than I had at the time. I will probably revisit that at a later
date.

Bye !

Francois B. wrote:

assert_equal ‘This will only show up on this action.’, flash[:notice]

But this doesn’t seem to work with flash.now.

Any thoughts?

I have this problem in the FlashHelper plugin. The problem is that as
soon as the action ends, the Flash is cleared. You would have to call
flash.keep somewhere to ensure all keys are kept.

Good point. I added an after filter to the controller in the test and it
let’s me get to it. Still there is no way to test if called flash or
flash#now.


John L.
http://wiseheartdesign.com
http://radiantcms.org