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