i’m in the process of writing some integration tests on a rails 2.3.8
app and am running into a bit of difficulty:
the following works just fine for me:
get “/login”
assert_response :success
assert_template “user_sessions/new”
post “/user_session”, :user_session => {:login =>
‘[email protected]’, :password => ‘secret’}
assert_redirected_to products_path
assert_equal “Logged in successfully”, flash[:notice]
however, the following does not work:
get “/login”
assert_response :success
assert_template “user_sessions/new”
post_via_redirect “/user_session”, :user_session => {:login =>
‘[email protected]’, :password => ‘secret’}
assert_select “div.flash”, “Logged in successfully”
assert_equal “Logged in successfully”, flash[:notice]
The last two asserts both fail as the flash[:notice] doesn’t seem to
be there anymore.
When I log in using a browser I do get a
to actually verify that this is actually showing up in the resulting
page that one gets when doing a login. Is this a bug in rails
integration tests, or am I overlooking something obvious?
- Thanks,
Francois