KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
There is a lot of confusion about setting cookies in rspec http://relishapp.com/rspec/rspec-rails/v/2-6/dir/controller-specs/file/cookies in your controller, normally you can write cookies['transaction_code'] = { :expires => 300.seconds.from_now, :value => c } but in rspec i can only write request.cookies['transaction_code'] = transaction_code if i say request.cookies['transaction_code'] = { :expires => 300.seconds.from_now, :value => c } i get the hash back as value of cookies['transaction_code'] in my controller. Now my question is: how do i set/test cookie expiry then in an rspec controller test example? UPDATE: On seconds thought: What i mean is: how do i test if the controller is reacts to an expired cookie as expected, but in fact an expired cookie is just like no cookie if i trust cookie implementation, which i should do, so after all maybe my question makes no sense. If this is the case, i need to test if (another) controller action sets an expiring cookie correctly, but how do i do it if cookies['transaction_code'] in the test only gives the value back?
Tags (comma-separated)
Save Edits
Cancel