Skip to content

Instantly share code, notes, and snippets.

@kulor
Created February 29, 2012 14:46
Show Gist options
  • Save kulor/1941293 to your computer and use it in GitHub Desktop.
Save kulor/1941293 to your computer and use it in GitHub Desktop.
Set a Capybara proxy using the http_proxy env
if ENV['TARGET_ENV'] && ENV['http_proxy'] && !ENV['http_proxy'].empty?
proxy = URI.parse(ENV['http_proxy'])
if Capybara.current_session.driver.respond_to?('agent') # mechanize only
Capybara.current_session.driver.agent.set_proxy(proxy.host, proxy.port)
puts "Using proxy #{proxy.host} #{proxy.port} from env"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment