Forum: Ruby on Rails testing for flash.now values

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
27f8beb57f4d56d328749b51ac886d2c?d=identicon&s=25 Kian (Guest)
on 2006-05-05 22:05
(Received via mailing list)
Is there any way in a functional test to get the value of the flash hash
if the value was set using flash.now? It doesn't appear to be visible in
flash in the test. Example:

Controller:

def index
  flash.now['notice'] = 'this is the index'
end

Functional Test:

def test_index_flash
  get :index
  assert_equal 'this is the index', flash['notice']
end

This will fail with the message:
<"this is the index"> expected but was
<nil>.

Any ideas? I've seen this come up in the mailing lists before,
but can't seem to find an answer or workaround. Or maybe just
an explanation -- why does this happen?

Thx
5233478c51a92b6a1a5c970cbf3a42f3?d=identicon&s=25 Isak Hansen (Guest)
on 2006-06-22 14:38
(Received via mailing list)
Did you learn anything on this? Would like to know myself.

Isak
This topic is locked and can not be replied to.