Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Created April 7, 2010 08:38
Show Gist options
  • Save aslakhellesoy/358664 to your computer and use it in GitHub Desktop.
Save aslakhellesoy/358664 to your computer and use it in GitHub Desktop.
module RackHeaderHack
def set_headers(headers)
driver = page.driver
def driver.env
@env.merge(super)
end
def driver.env=(env)
@env = env
end
driver.env = headers
end
end
World(RackHeaderHack)
Given /^I have some funky headers set by the proxy between the browser and my webapp$/ do
set_headers({"X-company" => "Bigcorp"})
end
@artemave
Copy link

To make this work with current version of capybara (1.0.0 as of this writing) change page.driver to page.driver.browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment