webdrivers 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 234dcf7f2f7e833833b3e8943d2f223f8eec99a280a31765b1e1eb7896e892d9
4
- data.tar.gz: fc80bb60c532e6ca7caf2b87a943671a20d0074be32455b1866c1476bcc04aad
3
+ metadata.gz: 57609975e2a5d45294e3bc698ded693c3c6eef7df57b758264afb9e5d132c71a
4
+ data.tar.gz: 8975564b199c769158c5bd4cf247b84276ac4718fafbce031fc025d2a4150e19
5
5
  SHA512:
6
- metadata.gz: ef17a229740ee31802abf2fe0a40a8534db9323d8ccc192263790b8892a243295fad8c2095c36d8870ef90ee1486014fffeef3cb06c514a55503352dda16e023
7
- data.tar.gz: b7f75184b2ed26a026106420230b6d439b674909c63eea9362214485408f3be7ecdff961912874bb03bc8f310844210bfac39b183083db85834f45d4295f9021
6
+ metadata.gz: 4e69935404700371ab1bad72ce3122064e850e8d89ae152b25cefe97ad7282527340c8f3e4f7fb2e45bed124ca248795f9b483393f72c6f606898c118f859b34
7
+ data.tar.gz: 4ce41c8a7fe0d16825828865bee12166557092f6ef633e728042118ffc1b05f6edb5457d69c787f513d98e319729b54b4bd0d65786a15f95c4d6063a3f956535
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- chromedriver.log
6
- /.idea/
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ chromedriver.log
6
+ /.idea/
data/.travis.yml CHANGED
@@ -8,4 +8,7 @@ rvm:
8
8
  - 2.4.1
9
9
  - jruby-9.2.0.0
10
10
  addons:
11
- chrome: stable
11
+ chrome: stable
12
+
13
+ before_script:
14
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install chromium-browser libgconf-2-4 ; fi
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 3.7.1 (2019-03-25)
2
+ * Use `Selenium::WebDriver::Chrome#path` to check for a user given browser executable before defaulting to Google Chrome. Addresses [#38](https://github.com/titusfortner/webdrivers/issues/38).
3
+ * Download `chromedriver` v2.46 if Chrome/Chromium version is less than 70.
4
+
1
5
  ### 3.7.0 (2019-03-19)
2
6
 
3
7
  * `chromedriver` version now matches the installed Chrome version. See [#32](https://github.com/titusfortner/webdrivers/pull/32).
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in webdrivers.gemspec
4
- gemspec
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in webdrivers.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2017: Titus Fortner
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- 'Software'), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017: Titus Fortner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Webdrivers
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/webdrivers.svg)](https://badge.fury.io/rb/webdrivers)
3
4
  [![Build status](https://api.travis-ci.org/titusfortner/webdrivers.svg)](https://travis-ci.org/titusfortner/webdrivers)
4
5
 
5
6
  Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
@@ -14,17 +15,23 @@ Currently supported:
14
15
  * `IEDriverServer`
15
16
  * `MicrosoftWebDriver`
16
17
 
17
- Drivers are stored in `~/.webdrivers` directory
18
+ Drivers are stored in `~/.webdrivers` directory, and this is configurable:
19
+
20
+ ```ruby
21
+ Webdrivers.install_dir = '/webdrivers/install/dir'
22
+ ```
18
23
 
19
24
  # Usage
20
25
 
21
- in your Gemfile:
26
+ In your Gemfile:
22
27
 
23
- `gem "webdrivers", "~> 3.0"`
28
+ `gem 'webdrivers', '~> 3.0'`
24
29
 
25
- in your project:
30
+ In your project:
26
31
 
27
- `require 'webdrivers'`
32
+ ```ruby
33
+ require 'webdrivers'
34
+ ```
28
35
 
29
36
  If there is a proxy between you and the Internet then you will need to configure
30
37
  the gem to use the proxy. You can do this by calling the `configure` method.
@@ -47,7 +54,24 @@ add the following to your code:
47
54
  Webdrivers.net_http_ssl_fix
48
55
  ````
49
56
 
50
- **Note when using Microsoft Edge**:
57
+ You can also specify the webdriver versions if you don't want the latest:
58
+
59
+ ```ruby
60
+ Webdrivers::Chromedriver.version = '2.46'
61
+ Webdrivers::Geckodriver.version = '0.17.0'
62
+ Webdrivers::IEdriver.version = '3.14.0'
63
+ Webdrivers::MSWebdriver.version = '17134'
64
+ ```
65
+
66
+ **Note when using Chrome/Chromium with Selenium**
67
+
68
+ You can configure the gem to use a specific browser version (Chrome vs Chromium) by providing the path to its binary:
69
+
70
+ ```ruby
71
+ Selenium::WebDriver::Chrome.path = '/chromium/install/path'
72
+ ```
73
+
74
+ **Note when using Microsoft Edge**
51
75
 
52
76
  After updating Microsoft Edge on Windows 10, you will need to delete the existing binary (`%USERPROFILE%/.webdrivers/MicrosoftWebDriver.exe`) to
53
77
  to be able to download the latest version through this gem.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -5,19 +5,26 @@ module Webdrivers
5
5
  class << self
6
6
 
7
7
  def current_version
8
- Webdrivers.logger.debug "Checking current version"
8
+ Webdrivers.logger.debug 'Checking current version'
9
9
  return nil unless downloaded?
10
- string = %x(#{binary} --version)
11
- Webdrivers.logger.debug "Current version of #{binary} is #{string}"
12
- normalize string.match(/ChromeDriver (\d+\.\d+)/)[1]
10
+
11
+ ver = `#{binary} --version`
12
+ Webdrivers.logger.debug "Current #{binary} version: #{ver}"
13
+
14
+ # Matches 2.46, 2.46.628411 and 73.0.3683.75
15
+ normalize ver[/\d+\.\d+(\.\d+)?(\.\d+)?/]
13
16
  end
14
17
 
15
18
  def latest_version
16
- raise StandardError, "Can not reach site" unless site_available?
19
+ raise StandardError, 'Can not reach site' unless site_available?
20
+
21
+ # Versions before 70 do not have a LATEST_RELEASE file
22
+ return Gem::Version.new('2.46') if release_version < '70.0.3538'
17
23
 
18
24
  # Latest webdriver release for installed Chrome version
19
25
  release_file = "LATEST_RELEASE_#{release_version}"
20
26
  latest_available = get(URI.join(base_url, release_file))
27
+ Webdrivers.logger.debug "Latest version available: #{latest_available}"
21
28
  Gem::Version.new(latest_available)
22
29
  end
23
30
 
@@ -68,23 +75,58 @@ module Webdrivers
68
75
  raise NotImplementedError, 'Your OS is not supported by webdrivers gem.'
69
76
  end.chomp
70
77
 
78
+ if ver.nil? || ver.empty?
79
+ raise StandardError, 'Failed to find Chrome binary or its version.'
80
+ end
81
+
71
82
  # Google Chrome 73.0.3683.75 -> 73.0.3683.75
72
83
  ver[/(\d|\.)+/]
73
84
  end
74
85
 
75
86
  def chrome_on_windows
76
- reg = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
77
- ps = "(Get-Item (Get-ItemProperty '#{reg}').'(Default)').VersionInfo.ProductVersion"
78
- `powershell #{ps}`
87
+ if browser_binary
88
+ Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
89
+ return `powershell (Get-ItemProperty '#{browser_binary}').VersionInfo.ProductVersion`
90
+ end
91
+
92
+ # Default to Google Chrome
93
+ reg = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
94
+ executable = `powershell (Get-ItemProperty '#{reg}' -Name '(default)').'(default)'`.strip
95
+ Webdrivers.logger.debug "Browser executable: '#{executable}'"
96
+ ps = "(Get-Item (Get-ItemProperty '#{reg}').'(default)').VersionInfo.ProductVersion"
97
+ `powershell #{ps}`.strip
79
98
  end
80
99
 
81
100
  def chrome_on_linux
82
- `google-chrome --version`
101
+ if browser_binary
102
+ Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
103
+ return `#{browser_binary} --product-version`.strip
104
+ end
105
+
106
+ # Default to Google Chrome
107
+ executable = `which google-chrome`.strip
108
+ Webdrivers.logger.debug "Browser executable: '#{executable}'"
109
+ `#{executable} --product-version`.strip
83
110
  end
84
111
 
85
112
  def chrome_on_mac
86
- loc = Shellwords.escape '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
87
- `#{loc} --version`
113
+ if browser_binary
114
+ Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
115
+ return `#{browser_binary} --version`.strip
116
+ end
117
+
118
+ # Default to Google Chrome
119
+ executable = Shellwords.escape '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
120
+ Webdrivers.logger.debug "Browser executable: #{executable}"
121
+ `#{executable} --version`.strip
122
+ end
123
+
124
+ #
125
+ # Returns user defined browser executable path from Selenium::WebDrivers::Chrome#path.
126
+ #
127
+ def browser_binary
128
+ # For Chromium, Brave, or whatever else
129
+ Selenium::WebDriver::Chrome.path
88
130
  end
89
131
  end
90
132
  end
@@ -1,109 +1,109 @@
1
- require 'forwardable'
2
- require 'logger'
3
-
4
- # Code adapted from Selenium Implementation
5
- # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/common/logger.rb
6
-
7
- module Webdrivers
8
- #
9
- # @example Enable full logging
10
- # Webdrivers.logger.level = :debug
11
- #
12
- # @example Log to file
13
- # Webdrivers.logger.output = 'webdrivers.log'
14
- #
15
- # @example Use logger manually
16
- # Webdrivers.logger.info('This is info message')
17
- # Webdrivers.logger.warn('This is warning message')
18
- #
19
- class Logger
20
- extend Forwardable
21
- include ::Logger::Severity
22
-
23
- def_delegators :@logger, :debug, :debug?,
24
- :info, :info?,
25
- :warn, :warn?,
26
- :error, :error?,
27
- :fatal, :fatal?,
28
- :level
29
-
30
- def initialize
31
- @logger = create_logger($stdout)
32
- end
33
-
34
- def output=(io)
35
- # `Logger#reopen` was added in Ruby 2.3
36
- if @logger.respond_to?(:reopen)
37
- @logger.reopen(io)
38
- else
39
- @logger = create_logger(io)
40
- end
41
- end
42
-
43
- #
44
- # For Ruby < 2.3 compatibility
45
- # Based on https://github.com/ruby/ruby/blob/ruby_2_3/lib/logger.rb#L250
46
- #
47
-
48
- def level=(severity)
49
- if severity.is_a?(Integer)
50
- @logger.level = severity
51
- else
52
- case severity.to_s.downcase
53
- when 'debug'.freeze
54
- @logger.level = DEBUG
55
- when 'info'.freeze
56
- @logger.level = INFO
57
- when 'warn'.freeze
58
- @logger.level = WARN
59
- when 'error'.freeze
60
- @logger.level = ERROR
61
- when 'fatal'.freeze
62
- @logger.level = FATAL
63
- when 'unknown'.freeze
64
- @logger.level = UNKNOWN
65
- else
66
- raise ArgumentError, "invalid log level: #{severity}"
67
- end
68
- end
69
- end
70
-
71
- #
72
- # Returns IO object used by logger internally.
73
- #
74
- # Normally, we would have never needed it, but we want to
75
- # use it as IO object for all child processes to ensure their
76
- # output is redirected there.
77
- #
78
- # It is only used in debug level, in other cases output is suppressed.
79
- #
80
- # @api private
81
- #
82
- def io
83
- @logger.instance_variable_get(:@logdev).instance_variable_get(:@dev)
84
- end
85
-
86
- #
87
- # Marks code as deprecated with replacement.
88
- #
89
- # @param [String] old
90
- # @param [String] new
91
- #
92
- def deprecate(old, new)
93
- warn "[DEPRECATION] #{old} is deprecated. Use #{new} instead."
94
- end
95
-
96
- private
97
-
98
- def create_logger(output)
99
- logger = ::Logger.new(output)
100
- logger.progname = 'Webdrivers'
101
- logger.level = ($DEBUG ? DEBUG : WARN)
102
- logger.formatter = proc do |severity, time, progname, msg|
103
- "#{time.strftime('%F %T')} #{severity} #{progname} #{msg}\n"
104
- end
105
-
106
- logger
107
- end
108
- end
109
- end
1
+ require 'forwardable'
2
+ require 'logger'
3
+
4
+ # Code adapted from Selenium Implementation
5
+ # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/common/logger.rb
6
+
7
+ module Webdrivers
8
+ #
9
+ # @example Enable full logging
10
+ # Webdrivers.logger.level = :debug
11
+ #
12
+ # @example Log to file
13
+ # Webdrivers.logger.output = 'webdrivers.log'
14
+ #
15
+ # @example Use logger manually
16
+ # Webdrivers.logger.info('This is info message')
17
+ # Webdrivers.logger.warn('This is warning message')
18
+ #
19
+ class Logger
20
+ extend Forwardable
21
+ include ::Logger::Severity
22
+
23
+ def_delegators :@logger, :debug, :debug?,
24
+ :info, :info?,
25
+ :warn, :warn?,
26
+ :error, :error?,
27
+ :fatal, :fatal?,
28
+ :level
29
+
30
+ def initialize
31
+ @logger = create_logger($stdout)
32
+ end
33
+
34
+ def output=(io)
35
+ # `Logger#reopen` was added in Ruby 2.3
36
+ if @logger.respond_to?(:reopen)
37
+ @logger.reopen(io)
38
+ else
39
+ @logger = create_logger(io)
40
+ end
41
+ end
42
+
43
+ #
44
+ # For Ruby < 2.3 compatibility
45
+ # Based on https://github.com/ruby/ruby/blob/ruby_2_3/lib/logger.rb#L250
46
+ #
47
+
48
+ def level=(severity)
49
+ if severity.is_a?(Integer)
50
+ @logger.level = severity
51
+ else
52
+ case severity.to_s.downcase
53
+ when 'debug'.freeze
54
+ @logger.level = DEBUG
55
+ when 'info'.freeze
56
+ @logger.level = INFO
57
+ when 'warn'.freeze
58
+ @logger.level = WARN
59
+ when 'error'.freeze
60
+ @logger.level = ERROR
61
+ when 'fatal'.freeze
62
+ @logger.level = FATAL
63
+ when 'unknown'.freeze
64
+ @logger.level = UNKNOWN
65
+ else
66
+ raise ArgumentError, "invalid log level: #{severity}"
67
+ end
68
+ end
69
+ end
70
+
71
+ #
72
+ # Returns IO object used by logger internally.
73
+ #
74
+ # Normally, we would have never needed it, but we want to
75
+ # use it as IO object for all child processes to ensure their
76
+ # output is redirected there.
77
+ #
78
+ # It is only used in debug level, in other cases output is suppressed.
79
+ #
80
+ # @api private
81
+ #
82
+ def io
83
+ @logger.instance_variable_get(:@logdev).instance_variable_get(:@dev)
84
+ end
85
+
86
+ #
87
+ # Marks code as deprecated with replacement.
88
+ #
89
+ # @param [String] old
90
+ # @param [String] new
91
+ #
92
+ def deprecate(old, new)
93
+ warn "[DEPRECATION] #{old} is deprecated. Use #{new} instead."
94
+ end
95
+
96
+ private
97
+
98
+ def create_logger(output)
99
+ logger = ::Logger.new(output)
100
+ logger.progname = 'Webdrivers'
101
+ logger.level = ($DEBUG ? DEBUG : WARN)
102
+ logger.formatter = proc do |severity, time, progname, msg|
103
+ "#{time.strftime('%F %T')} #{severity} #{progname} #{msg}\n"
104
+ end
105
+
106
+ logger
107
+ end
108
+ end
109
+ end
@@ -1,29 +1,29 @@
1
- require 'selenium-webdriver'
2
-
3
- module Selenium
4
- module WebDriver
5
- module Chrome
6
- def self.driver_path
7
- @driver_path ||= Webdrivers::Chromedriver.update
8
- end
9
- end
10
-
11
- module Firefox
12
- def self.driver_path
13
- @driver_path ||= Webdrivers::Geckodriver.update
14
- end
15
- end
16
-
17
- module Edge
18
- def self.driver_path
19
- @driver_path ||= Webdrivers::MSWebdriver.update
20
- end
21
- end
22
-
23
- module IE
24
- def self.driver_path
25
- @driver_path ||= Webdrivers::IEdriver.update
26
- end
27
- end
28
- end
29
- end
1
+ require 'selenium-webdriver'
2
+
3
+ module Selenium
4
+ module WebDriver
5
+ module Chrome
6
+ def self.driver_path
7
+ @driver_path ||= Webdrivers::Chromedriver.update
8
+ end
9
+ end
10
+
11
+ module Firefox
12
+ def self.driver_path
13
+ @driver_path ||= Webdrivers::Geckodriver.update
14
+ end
15
+ end
16
+
17
+ module Edge
18
+ def self.driver_path
19
+ @driver_path ||= Webdrivers::MSWebdriver.update
20
+ end
21
+ end
22
+
23
+ module IE
24
+ def self.driver_path
25
+ @driver_path ||= Webdrivers::IEdriver.update
26
+ end
27
+ end
28
+ end
29
+ end
@@ -25,7 +25,7 @@ describe Webdrivers::Chromedriver do
25
25
  chromedriver.remove
26
26
  chromedriver.download
27
27
  cur_ver = chromedriver.current_version.version
28
- latest_ver = chromedriver.latest_version.version[0..3] # "72.0.3626.69" - > "72.0"
28
+ latest_ver = chromedriver.latest_version.version
29
29
  expect(cur_ver).to eq latest_ver
30
30
  end
31
31
 
@@ -33,14 +33,14 @@ describe Webdrivers::Chromedriver do
33
33
  chromedriver.remove
34
34
  chromedriver.version = 2.29
35
35
  chromedriver.download
36
- expect(chromedriver.current_version.version).to eq '2.29'
36
+ expect(chromedriver.current_version.version).to include '2.29'
37
37
  end
38
38
 
39
39
  it 'downloads specified version by String' do
40
40
  chromedriver.remove
41
- chromedriver.version = '74.0.3729.6'
41
+ chromedriver.version = '73.0.3683.68'
42
42
  chromedriver.download
43
- expect(chromedriver.current_version.version).to eq '74.0'
43
+ expect(chromedriver.current_version.version).to eq '73.0.3683.68'
44
44
  end
45
45
 
46
46
  it 'removes chromedriver' do
@@ -48,6 +48,22 @@ describe Webdrivers::Chromedriver do
48
48
  expect(chromedriver.current_version).to be_nil
49
49
  end
50
50
 
51
+ if Selenium::WebDriver::Platform.linux? && ENV['TRAVIS']
52
+ # Ubuntu 14.04 (trusty) is limited to v65
53
+ context 'when using a Chromium version < 70.0.3538' do
54
+ before do
55
+ chromedriver.remove
56
+ chromedriver.version = nil
57
+ Selenium::WebDriver::Chrome.path = `which chromium-browser`.strip
58
+ end
59
+
60
+ it 'downloads chromedriver 2.46' do
61
+ chromedriver.update
62
+ expect(chromedriver.current_version.version[/\d+.\d+/]).to eq('2.46')
63
+ end
64
+ end
65
+ end
66
+
51
67
  context 'when offline' do
52
68
  before { allow(chromedriver).to receive(:site_available?).and_return(false) }
53
69
 
@@ -1,45 +1,45 @@
1
- require 'spec_helper'
2
-
3
- class FakeDriver < Webdrivers::Common
4
- def self.http_object
5
- self.http
6
- end
7
- end
8
-
9
- describe "Support for proxies" do
10
- let(:http_object) { FakeDriver.http_object }
11
-
12
- before do
13
- Webdrivers.proxy_addr = nil
14
- Webdrivers.proxy_port = nil
15
- Webdrivers.proxy_user = nil
16
- Webdrivers.proxy_pass = nil
17
- end
18
-
19
- it 'should allow the proxy values to be set via configuration' do
20
- Webdrivers.configure do |config|
21
- config.proxy_addr = 'proxy_addr'
22
- config.proxy_port = '8888'
23
- config.proxy_user = 'proxy_user'
24
- config.proxy_pass = 'proxy_pass'
25
- end
26
-
27
- expect(Webdrivers.proxy_addr).to eql 'proxy_addr'
28
- expect(Webdrivers.proxy_port).to eql '8888'
29
- expect(Webdrivers.proxy_user).to eql 'proxy_user'
30
- expect(Webdrivers.proxy_pass).to eql 'proxy_pass'
31
- end
32
-
33
- it 'should use the Proxy when the proxy_addr is set' do
34
- Webdrivers.configure do |config|
35
- config.proxy_addr = 'proxy_addr'
36
- config.proxy_port = '8080'
37
- end
38
-
39
- expect(http_object.instance_variable_get('@is_proxy_class')).to be true
40
- end
41
-
42
- it 'should not use the Proxy when proxy is not configured' do
43
- expect(http_object.instance_variable_get('@is_proxy_class')).to be false
44
- end
1
+ require 'spec_helper'
2
+
3
+ class FakeDriver < Webdrivers::Common
4
+ def self.http_object
5
+ self.http
6
+ end
7
+ end
8
+
9
+ describe "Support for proxies" do
10
+ let(:http_object) { FakeDriver.http_object }
11
+
12
+ before do
13
+ Webdrivers.proxy_addr = nil
14
+ Webdrivers.proxy_port = nil
15
+ Webdrivers.proxy_user = nil
16
+ Webdrivers.proxy_pass = nil
17
+ end
18
+
19
+ it 'should allow the proxy values to be set via configuration' do
20
+ Webdrivers.configure do |config|
21
+ config.proxy_addr = 'proxy_addr'
22
+ config.proxy_port = '8888'
23
+ config.proxy_user = 'proxy_user'
24
+ config.proxy_pass = 'proxy_pass'
25
+ end
26
+
27
+ expect(Webdrivers.proxy_addr).to eql 'proxy_addr'
28
+ expect(Webdrivers.proxy_port).to eql '8888'
29
+ expect(Webdrivers.proxy_user).to eql 'proxy_user'
30
+ expect(Webdrivers.proxy_pass).to eql 'proxy_pass'
31
+ end
32
+
33
+ it 'should use the Proxy when the proxy_addr is set' do
34
+ Webdrivers.configure do |config|
35
+ config.proxy_addr = 'proxy_addr'
36
+ config.proxy_port = '8080'
37
+ end
38
+
39
+ expect(http_object.instance_variable_get('@is_proxy_class')).to be true
40
+ end
41
+
42
+ it 'should not use the Proxy when proxy is not configured' do
43
+ expect(http_object.instance_variable_get('@is_proxy_class')).to be false
44
+ end
45
45
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- require "rspec"
2
- require "webdrivers"
1
+ require "rspec"
2
+ require "webdrivers"
data/webdrivers.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('../lib', __dir__)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'webdrivers'
7
- s.version = '3.7.0'
7
+ s.version = '3.7.1'
8
8
  s.authors = ['Titus Fortner', 'Lakshya Kapoor']
9
9
  s.email = %w[titusfortner@gmail.com kapoorlakshya@gmail.com]
10
10
  s.homepage = 'https://github.com/titusfortner/webdrivers'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-19 00:00:00.000000000 Z
12
+ date: 2019-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.0.3
148
+ rubygems_version: 3.0.2
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Easy download and use of browser drivers.