How can I set the HTTP_REFERER request header for a request made from a cucumber step definition using capybara?
Googling around, I tried the following, none of which work:
header 'Referer', 'http://example.com/'
ENV['HTTP_REFERER'] = 'http://example.com/'
get '/', {}, { 'HTTP_REFERER' => 'http://example.com/' }
get '/', nil, { 'HTTP_REFERER' => 'http://example.com/' }
request.env['HTTP_REFERER'] = 'http://example.com/' # raises ArgumentError
visit '/'
I'm printing request.env['HTTP_REFERER'] in the controller, to prove that it's not coming through. If I test the controller with a web browser, the referer is printed correctly.
Note that the 3-parameter use of get above, actually does get the HTTP_REFERER into the request environment observed by the controller, but it seems to perturb the request in a way I can't figure out; all that gets rendered is a doctype element.
I'm using the default cucumber driver, Cucumber::RackTest::Driver, with cucumber-1.1.3, cucumber-rails-1.2.0 and capybara-1.1.2.