Ben Lovell wrote:
> On 16 April 2010 15:59, Ben Lovell <benjamin.lov...@gmail.com> wrote:
> 
>> Try:
>>
>> post 'whatever', {}, {'rack.session' => {:something=>'value'}}
>>
>> To put things through the session with rack test/sinatra.
>>
>> Sent from my iPhone
>>
>>
> Hmm, hold up, that isn't what you asked for :)
> 
> You have to remember that the default Rack::Test::CookieJar#[] only 
> returns
> cookies that exactly match the domain and path of the current request so 
> be
> sure to check there first.

I think this is more of a Sinatra issue, and not an rspec issue.  But, 
since I'm a Sinatra fan, I thought I'd weigh in, since I just went 
through this and it was harder then I would've expected.

If you want to pass session values in tests, you'll have to disable 
sessions in your sinatra app.  I've got a blog post at 
http://benprew.posterous.com/ with the details.

Also, I had to do this in one of my apps recently, take a look at the 
Rakefile, picklespears.com and test/test_player.rb at 
http://github.com/benprew/picklespears

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to