David Michael
2008-Jan-16 18:00 UTC
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
White Wizzard
2008-Jan-29 14:14 UTC
Re: Error with session ids in integration tests (Rails 2.0.x) ?
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---