cucumber is not respecting cookies set by server
I'm working on migrating a large set of cucumber features from Webrat to Capybara and I'm running into quite a few issues. The primary (and most painful) issue is around cookies.
First problem was "how to set cookies" as there are various features that set cookies (some for logging in, some for setting referral codes, etc). We solved this by borrowing some code from the show me the cookies gem.
The next problem is that sometimes the server deletes cookies, but the problem we've found is that Cucumber (or is Capybara responsible for this?) doesn't reset the cookies to what was returned by the server on subsequent requests.
At first I thought I could hack aroun开发者_开发知识库d this by doing an AfterStep
that cleared the cookies and set them to what was returned by the server in the headers 'Set-Cookie'.
Unfortunately this won't work when dealing with a redirect, because Cucumber/Capybara follows the redirect before calling my AfterStep
, thus causing failing features.
This has been quite difficult and any help would be greatly appreciated. Here is some relevant environment information:
gem 'rails', '2.3.10'
gem 'cucumber', '0.10.7'
gem 'cucumber-rails', '0.3.2'
gem 'capybara', '0.4.1.2'
精彩评论