Tuesday, June 4, 2013

[Rails] Is flash[] value kept through action to action in integration tests?

I have an integration test that sets a flash[] value in action before
redirect and reads it in the next action (the one that previous action
redirects to):

test("some integration test") do
get("/one")
assert_equal(true, flash[:foo]) ## is set to true in this action
assert_response(:redirect)

follow_redirect!

assert_equal(true, flash[:foo]) ## has to be true in next action
end

So flash[:foo] has to be "true" in the second action. Because it is set
in the first one. But my test throws an error:

1) Failure:
<true> expected but was <nil>.

My question is, are flash values kept in integration test? Does it have
to be "true" here or the above behavior is correct?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/89106bcd798e975ad8c532dc8ac10d56%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate