[rspec-users] Cookie assignment and reading

David Chelimsky dchelimsky at gmail.com
Thu Jul 1 15:27:52 EDT 2010


On Jun 29, 2010, at 4:05 PM, Josh Clayton wrote:

> Hello all,
> 
> I'm running the latest stable rspec/rspec-rails (1.3.0/1.3.2) in a
> Rails 2.3.8 app and am having trouble testing that a cookie gets
> deleted.
> 
> In a semi-convoluted manner, I am essentially running code from the
> rdoc as such:
> 
>    describe MyController, "GET index" do
>      let(:cookie_value) { "of course" }
> 
>      it "should delete the cookie" do
>        cookies[:awesome] = cookie_value
>        get :index
>        cookies[:awesome].should == cookie_value
>      end
>    end
> 
> This is obviously example code but the outcome effect is the same -
> trying to find the value of a cookie I set with RSpec fails.  For my
> specific, real-life example, I'm assigning a cooking and performing a
> request in the before block and testing that the cookie is deleted.
> It's passing, but incorrectly (since I haven't performed the deletion
> in my controller action).
> 
> Any insight would be appreciated; thanks!

That should work. Please file a bug: http://rspec.lighthouseapp.com/

Thx,
David


More information about the rspec-users mailing list