[rspec-users] Cookies - how to set in controller specs?

David Chelimsky dchelimsky at gmail.com
Wed Jul 2 14:45:13 EDT 2008


On Jul 2, 2008, at 1:44 PM, Craig Demyanovich wrote:

>> I'm thinking of replacing the existing cookies() method (in the  
>> example)
>> with one that returns a CookieJarProxy that will allow you to do  
>> any of the
>> following:
>>
>> cookies['cookie_key'] = 'cookie value'
>> cookies[:cookie_key] = 'cookie value'
>>
>> cookies['cookie_key'].should == 'cookie value'
>> cookies[:cookie_key].should == 'cookie value'
>>
>> WDYT about that?
>
> David, do you plan to allow checks that other values are set as we'd
> expect? Other values include:
>
> * :value
> * :path
> * :domain
> * :expires
> * :secure
> * :http_only
>
> http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M000352&name=cookies
>
> For example, I'd like to verify that I update the value and  
> expiration date:
>
> it "resets the cookie with the value and new expiration date" do
>  get_index
>  cookies[:project_sort][:value].should == "name"
>  cookies[:project_sort][:expires].beginning_of_day.should ==
> 1.year.from_now.beginning_of_day

I had not planned that, no :)

Let me get the basics working first and we can talk about beefing it  
up like this later.

>
> end
>
> Thanks,
> Craig
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list