Integration testing

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

Logged in successfully
and I’d like my integration test
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

Francois wrote in post #950301:

i’m in the process of writing some integration tests on a rails 2.3.8
app

Don’t waste your time. Use Cucumber. Much less painful and more
comprehensive.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Why not you trying for Rspec or Cucumber…??

Good Luck :wink:

-Ganesh K