I''ve found that for some complicated controllers, doing things like setting sessions in after_filters, the Integration Tests loose the session. The controllers work fine in development and production. But, under Integration Tests, the sessions seem to drop. I haven''t been able to isolate the bug - that is, build a simple controller which demonstrates the behavior. Mocking out the session by doing something crude like this always fixes it: $session = Hash.new class ActionController::Base def session $session end end class MyIntegrationTest < ActionController::IntegrationTest ... (Not sure how to unmock that). Has anyone else experienced this? And, how can I unmock that behavior, so that my functional tests aren''t affected? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Some heavy duty logging/debugging shows that: * It''s not due to loosing the cookie - the _session_id is correct * The problems happen at the session[...]=... - for some reason, that doesn''t call correctly under IntegrationTests Robert James wrote:> I''ve found that for some complicated controllers, doing things like > setting sessions in after_filters, the Integration Tests loose the > session. > > The controllers work fine in development and production. But, under > Integration Tests, the sessions seem to drop. > > I haven''t been able to isolate the bug - that is, build a simple > controller which demonstrates the behavior. > > Mocking out the session by doing something crude like this always fixes > it: > > $session = Hash.new > > class ActionController::Base > def session > $session > end > end > > class MyIntegrationTest < ActionController::IntegrationTest > ... > > (Not sure how to unmock that). > > Has anyone else experienced this? And, how can I unmock that behavior, > so that my functional tests aren''t affected?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
What version of Rails, are you using? The Rails 1.2 RC1 has bugs that are open for some of the Integration testing APIs. I would take results of the Integration tests with a grain of salt. It is better to use something like Selenium on Rails as a substitute for Integration testing. On 12/10/06, Robert James <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Some heavy duty logging/debugging shows that: > * It''s not due to loosing the cookie - the _session_id is correct > * The problems happen at the session[...]=... - for some reason, that > doesn''t call correctly under IntegrationTests > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bala Paranj wrote:> What version of Rails, are you using? The Rails 1.2 RC1 has bugs that > are > open for some of the Integration testing APIs. > > I would take results of the Integration tests with a grain of salt. It > is > better to use something like Selenium on Rails as a substitute for > Integration testing.1.1.6 - (I think I tried with 1.2rc1 also). I think the cause is that Integration tests try to capture out the controller, invoking some vodoo. It may be better to just leave this out - if you need access to the controller, use functional tests. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---