lib/capybara/webmock.rb in capybara-webmock-0.3.0 vs lib/capybara/webmock.rb in capybara-webmock-0.4.0
- old
+ new
@@ -15,11 +15,11 @@
proxy_file = File.join(gem_path, 'webmock', 'config.ru')
IO.popen("PROXY_PORT_NUMBER=#{port_number} rackup #{proxy_file} >> #{log_file} 2>&1")
end
def stop
- if File.exists?(Capybara::Webmock::Proxy::PID_FILE)
+ if File.exist?(Capybara::Webmock::Proxy::PID_FILE)
rack_pid = File.read(Capybara::Webmock::Proxy::PID_FILE).to_i
Process.kill('HUP', rack_pid)
end
end
@@ -36,10 +36,13 @@
def chrome_switches
["--proxy-server=127.0.0.1:#{port_number}"]
end
+ def phantomjs_options
+ ["--proxy=127.0.0.1:#{port_number}"]
+ end
end
end
end
Capybara::Webmock.port_number ||= 9292
@@ -48,6 +51,10 @@
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: Capybara::Webmock.firefox_profile)
end
Capybara.register_driver :capybara_webmock_chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome, switches: Capybara::Webmock.chrome_switches)
+end
+
+Capybara.register_driver :capybara_webmock_poltergeist do |app|
+ Capybara::Poltergeist::Driver.new(app, phantomjs_options: Capybara::Webmock.phantomjs_options)
end