# Rails 2.2 Integration tests cookie store

**URL:** <https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918>\
**Category:** Rails\
**Created:** [November 23, 2008, 12:07am UTC](https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918 "2008-11-23T00:07:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@darren](https://www.ruby-forum.com/u/darren)\
**Post date:** [November 23, 2008, 12:07am UTC](https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918/1 "2008-11-23T00:07:39Z")

</div>

I’ve upgraded an existing application from 2.1 to 2.2.2. All of the  
integration tests failed, complaining about there being no ‘secret’  
defined in the session\_store configuration options. There isn’t a  
secret defined, since we don’t use the cookie session store (it’s a  
wap site, and many phone browsers don’t support cookies). Setting the  
secret to an appropriate value fixed all the tests.

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? Or should we be finding a better way to do  
higher level integration tests?

Thanks,  
Darren

---

<div class="post-metadata">

**Author:** ![darren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@darren](https://www.ruby-forum.com/u/darren)\
**Post date:** [December 9, 2008, 11:45pm UTC](https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918/2 "2008-12-09T23:45:31Z")

</div>

What I ended up doing was overriding the default options in  
RackRequest.

In test.rb, I added

class ActionController::RackRequest  
DEFAULT\_SESSION\_OPTIONS = {  
:database\_manager =\> CGI::Session::MemoryStore, # store data in  
memory  
:prefix =\> “ruby\_sess.”, # prefix session file names  
:session\_path =\> “/”, # available to all paths in  
app  
:session\_key =\> “\_session\_id”,  
:cookie\_only =\> false,  
:session\_http\_only=\> true  
}  
end

I get a warning about the constant already being defined, but it’s  
better than having the tests fail.

Also see \<[#1453 'get's in integration test unless you are using cookie sessions - Ruby on Rails - rails](http://rails.lighthouseapp.com/projects/8994/tickets/1453-)  
gets-in-integration-test-unless-you-are-using-cookie-sessions\>.

Lee

---

<div class="post-metadata">

**Author:** ![darren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@darren](https://www.ruby-forum.com/u/darren)\
**Post date:** [January 21, 2009, 10:20am UTC](https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918/3 "2009-01-21T10:20:59Z")

</div>

Someone to give me the configuration for  
“config.action\_controller.session\_store = :active\_record\_store” ?!

Thanks.

---

<div class="post-metadata">

**Author:** ![darren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@darren](https://www.ruby-forum.com/u/darren)\
**Post date:** [February 3, 2009, 9:16am UTC](https://www.ruby-forum.com/t/rails-2-2-integration-tests-cookie-store/153918/4 "2009-02-03T09:16:09Z")

</div>

Ok the good configuration for Session store une database by  
ActiveRecord is :

class ActionController::RackRequest  
DEFAULT\_SESSION\_OPTIONS = {  
:database\_manager =\> CGI::Session::ActiveRecordStore,  
:cookie\_only =\> false,  
:session\_http\_only=\> true  
}  
end

Add this code in integration test.
