Error with session ids in integration tests (Rails 2.0.x)?

Hello list

In writing integration tests dealing with session variables, I am
coming across some interesting behavior. It seems that the session id
changes after every request.

class RatingIntegrationTest < ActionController::IntegrationTest
def test_anonymous_rating

open_session do |sess|
  sess.post "/rating/create?

rating[rating]=5&rating[video_id]=#{ default_video.id }"

  ## THIS GIVES ONE RESULT
  puts sess.cookies["_myapp_session_id"]

  sess.post( "/rating/create?

rating[rating]=1&rating[video_id]=#{ default_video.id }" )

  ## THIS GIVES ANOTHER RESULT!
  puts sess.cookies["_myapp_session_id"]
end

end
end

Is there a better way to get the session id?
Is this code incorrect?

Thanks in advance,
David

Hi David
I am having the same issue when I try to use my own authentication
method. the Seesion Id Changes at certain POST requestsand I loose my
authentication. If you have found a solution please post it.

WW

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs