Skip to content

Commit

Permalink
A few fixes for Ruby 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jarib committed Oct 17, 2013
1 parent abd17ef commit 9604356
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/remote/capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def [](key)
end

def merge!(other)
if other.respond_to?(:capabilities) && other.capabilities.kind_of?(Hash)
if other.respond_to?(:capabilities, true) && other.capabilities.kind_of?(Hash)
@capabilities.merge! other.capabilities
elsif other.kind_of? Hash
@capabilities.merge! other
Expand Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/remote/http/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def use_proxy?
host == server_url.host || (
begin
IPAddr.new(host).include?(server_url.host)
rescue ArgumentError
rescue ArgumentError => ex
false
end
)
Expand Down
20 changes: 11 additions & 9 deletions rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,19 @@ module Http
end
end

it "understands a comma separated list of domains in #{no_proxy_var}" do
with_env("HTTP_PROXY" => "proxy.org:8080", no_proxy_var => "example.com,foo.com") do
http = client.send :http
http.should_not be_proxy
it "understands a comma separated list of domains in #{no_proxy_var}" do
with_env("HTTP_PROXY" => "proxy.org:8080", no_proxy_var => "example.com,foo.com") do
http = client.send :http
http.should_not be_proxy
end
end
end

it "understands an asterisk in #{no_proxy_var}" do
with_env("HTTP_PROXY" => "proxy.org:8080", no_proxy_var => "*") do
http = client.send :http
http.should_not be_proxy
unless RUBY_VERSION > "2.1" # Ruby 2.1 does its own proxy handling in net/http, which breaks this behaviour
it "understands an asterisk in #{no_proxy_var}" do
with_env("HTTP_PROXY" => "proxy.org:8080", no_proxy_var => "*") do
http = client.send :http
http.should_not be_proxy
end
end
end

Expand Down
1 change: 1 addition & 0 deletions rb/spec/unit/selenium/webdriver/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'ci/reporter/rspec'
require 'webmock/rspec'
require 'selenium-webdriver'
require 'pry'

module Selenium
module WebDriver
Expand Down

0 comments on commit 9604356

Please sign in to comment.