Created
February 29, 2012 14:46
-
-
Save kulor/1941293 to your computer and use it in GitHub Desktop.
Set a Capybara proxy using the http_proxy env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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