This project is archived and is in readonly mode.
'get's in integration test unless you are using cookie sessions
-
Fjan
It looks like the integration test is actually using the cookie store instead of the configured store, because cookies[SESSION_KEY] changes on every request (even though ApplicationController::session_store reports otherwise)
I have a bunch of test failing because my app assumes a new sessions starts when it gets a new value for cookies[SESSION_KEY]
-
josh
- Assigned user set to josh
- State changed from new to open
Are you on edge? Can you please make a failing unit test?
-
Fjan
I'm not on edge, but in Rails 2.2 you will see almost any test fail as soon as you remove this line from your environment.rb.
"config.action_controller.session = {:sesion_key..."
(A test with just get '/' in it should do.)
-
josh
- State changed from open to wontfix
Yeah, if you are going use cookie sessions you do need to give a key.
If you mean to use a different store, try
config.action_controller.session_store = :mem_cache_store # or config.action_controller.session_store = nil -
Fjan
Uhm, no, that's the point of this ticket. We DON'T want to use the cookie store, and yet it gives us errors for not supplying a key (only when testing, rails runs fine otherwise)
-
jfoxny
I too am seeing this behavior. I tried to specify a different session store but it still complains about, "...A secret is required to generate an integrity hash for cookie session data." Furthermore, when I do try to use the cookie session store I receive a CGI::Session::CookieStore::CookieOverflow exception. This is only an issue with integration testing.
-
Joël AZEMAR
same for me, I use config.action_controller.session_store = :active_record_store in my app and the integration tests fails with "CGI::Session::CookieStore::CookieOverflow (CGI::Session::CookieStore::CookieOverflow)" message ... You have an temporary solution ?!
-
josh
Could you guys create a failing unit test to apply to AP
-
Fjan
Pretty much any integration test will fail as soon as you set the session store to active record and remove the cookie session key. (Which shouldn't be cause for failure, of course).
So as a unit test you can just do get '/'
-
Joël AZEMAR
Simple and minimalist sample.
-
Joël AZEMAR
What new ??!
-
Joe
When is it going to be fixed? I'm receiving errors for my integration tests after upgrading from 2.1.x to 2.2.2:
117 1) Error: 118 test_logging_into_account1(StoriesTest): 119 NoMethodError: You have a nil object when you didn't expect it! 120 You might have expected an instance of ActiveRecord::Base. 121 The error occurred while evaluating nil.[]= 122 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:294:in
process' 123 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:185:inget' 124 /home/admin/sites//test/integration/stories_test.rb:30:inis_logging_in_as' 125 /home/admin/sites/<removed>/test/integration/stories_test.rb:132:intest_logging_into_account1' 126 /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:60:in__send__' 127 /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:60:inrun' 128 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:597:inrun' -
sdawara
There's a temporary solution here:
-
Christopher J. Bottaro
I left my session_key and secret in environment.rb despite that fact that I'm NOT using cookie store for my sessions and I'm still getting integration test failures: CGI::Session::CookieStore::CookieOverflow.
As previously pointed out, it seems like integration tests don't honor the ActionController::Base.session_store setting.
Here's a (tiny) test case:
app/controllers/foo_controller.rb http://pastie.org/372912
test/integration/foo_test.rb http://pastie.org/372914
-
holli
I'm currently upgrading from 2.0.2 to 2.2.2 and came across this same problem. I'm using active_record_store as my session_store.
sdawara's link was helpful, quoting a block from there: "It looks like the database_manager is hardcoded to be a CookieStore in rack_process.rb. Is there any plan on getting integration tests to use the actual configured cookie store?"
Before this, I did not have any cookie session info in my environment.rb, but adding "config.action_controller.session = {:session_key => ..., :secret => ...}" removed the problem for now.
Still the integration test wont actually test the session database, i.e. interation tests would pass even if I would not have session table in my database (in which case the server would crash if I would try to run it.)
same issue happens when using script/console >> "app.get '/'"
Is this ticket really going to be 'notfixed'?
-
Fjan
This is fixed in 2.3.2
-
Chris Wilson
Upgrading to 2.3.x brings its own set of problems. If you don't want to upgrade, you can do this in your test setup or test environment instead:
ActionController::RackRequest::DEFAULT_SESSION_OPTIONS[:database_manager] = CGI::Session::ActiveRecordStore
