Session not being reset in integration tests

Hi -

I'm trying to use Rails integration tests to test across controllers/actions. Unfortunately, the integration tests break other (unit) tests because the integration tests leave around data in the session. We can tell this because the tests that fail involve asserts on redirects that should happen when the session is empty (i.e., when the user is not logged in). Here's what I'm doing:

  def test_pagination     s = open_session do |s|       login_as(users(:sarah))       # rest of the test here...     end     s.reset!   end

Additionally, I've tried other ways of resetting the session, including skipping the open_session block and just calling reset! in teardown, as well as 'get "/user/logout"' to force the session to be reset through the app.

The api documentation as well as the Rails Recipe book suggest that this should work. Am I missing something simple or does someone have some insight to this problem? Thanks!

pt

Perhaps I'm missing something but I don't see why this doesn't work. Using 'open_session' should create a new session instance enabling us to mimic multiple users hitting the server. Each session instance should be seperate; isolated from the others.

Is it possible you're inadvertantly setting an application-level session variable and asserting based on that value?

Parker Thompson wrote: