Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up proxy interface

  • Loading branch information...
commit 93bfcf6e4642b14a1f401706f14bf672568fa7f0 1 parent 229a20e
@halogenandtoast halogenandtoast authored
View
24 lib/capybara/driver/webkit/browser.rb
@@ -99,16 +99,13 @@ def get_cookies
command("GetCookies").lines.map{ |line| line.strip }.select{ |line| !line.empty? }
end
- def set_proxy(opts = {})
- # remove proxy?
- return command("SetProxy") if opts.empty?
+ def set_proxy(options = {})
+ options = default_proxy_options.merge(options)
+ command("SetProxy", options[:host], options[:port], options[:user], options[:pass])
+ end
- # set a HTTP proxy
- command("SetProxy",
- opts[:host] || "localhost",
- opts[:port] || "0",
- opts[:user] || "",
- opts[:pass] || "")
+ def clear_proxy
+ command("SetProxy")
end
private
@@ -206,5 +203,14 @@ def read_response
response.force_encoding("UTF-8") if response.respond_to?(:force_encoding)
response
end
+
+ def default_proxy_options
+ {
+ :host => "localhost",
+ :port => "0",
+ :user => "",
+ :pass => ""
+ }
+ end
end
end
View
2  spec/browser_spec.rb
@@ -170,7 +170,7 @@
it 'is possible to disable proxy again' do
@proxy_requests.clear
- browser.set_proxy
+ browser.clear_proxy
browser.visit "http://#{@host}:#{@port}/"
@proxy_requests.size.should == 0
end
View
1  src/CommandFactory.cpp
@@ -17,6 +17,7 @@
#include "SetCookie.h"
#include "ClearCookies.h"
#include "GetCookies.h"
+#include "SetProxy.h"
CommandFactory::CommandFactory(WebPage *page, QObject *parent) : QObject(parent) {
m_page = page;
Please sign in to comment.
Something went wrong with that request. Please try again.