Nick Snels
2006-Mar-15 13:10 UTC
[Rails] Session (stored in db) not working in testing mode
Hi,
I just switched from storing my sessions on disk to storing them in
MySQL. Changing environment.rb ''config.action_controller.session_store
=
:active_record_store''. But now all my tests fail. I get the following
error:
1) Failure:
test_authorized_new(AdControllerTest)
[c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/depr
ecated_assertions.rb:23:in `assert_session_has''
./functional/../test_helper.rb:34:in `login''
functional/ad_controller_test.rb:49:in `test_authorized_new'']:
<:user_id> is not in the session
<#<ActionController::TestSession:0x31d2198
@attributes={"flash"=>{}}>>
Have I overlooked something?
Kind regards,
Nick
--
Posted via http://www.ruby-forum.com/.
Julian Leviston
2006-Mar-15 13:19 UTC
[Rails] Session (stored in db) not working in testing mode
You''ve created the sessions table properly, right? my sessions table usually has: id(int11), session_id(int11), data(text), updated_at(datetime) Julian. On 16/03/2006, at 12:10 AM, Nick Snels wrote:> Hi, > > I just switched from storing my sessions on disk to storing them in > MySQL. Changing environment.rb > ''config.action_controller.session_store > :active_record_store''. But now all my tests fail. I get the following > error: > > 1) Failure: > test_authorized_new(AdControllerTest) > [c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ > action_controller/depr > ecated_assertions.rb:23:in `assert_session_has'' > ./functional/../test_helper.rb:34:in `login'' > functional/ad_controller_test.rb:49:in `test_authorized_new'']: > <:user_id> is not in the session > <#<ActionController::TestSession:0x31d2198 @attributes={"flash"=>{}}>> > > Have I overlooked something? > > Kind regards, > > Nick > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Nick Snels
2006-Mar-15 13:53 UTC
[Rails] Re: Session (stored in db) not working in testing mode
Yes, I guess. It contains: id (int(11)), session_id (varchar(50)), user_id(int11)), data (text), created_at (datetime) and updated_at(datetime). In development mode it works perfectly, only in testing mode it starts throwing errors. Nick -- Posted via http://www.ruby-forum.com/.