Skip to content

Commit 4214b81

Browse files
committed
[rb] don't default args to array
1 parent ca9f24c commit 4214b81

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

rb/lib/selenium/webdriver/chrome/driver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def create_capabilities(opts)
7474
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.chrome }
7575
options = opts.delete(:options) { Options.new }
7676

77-
args = opts.delete(:args)|| opts.delete(:switches) || []
77+
args = opts.delete(:args) || opts.delete(:switches)
7878
if args
7979
WebDriver.logger.deprecate ':args or :switches', 'Selenium::WebDriver::Chrome::Options#add_argument'
8080
raise ArgumentError, ':args must be an Array of Strings' unless args.is_a? Array

rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ module Chrome
4040
expect(caps[:chrome_options][:args]).to eq(%w[--foo=bar])
4141
end
4242

43+
it 'sets the args capability from switches' do
44+
Driver.new(http_client: http, switches: %w[--foo=bar])
45+
46+
expect(caps[:chrome_options][:args]).to eq(%w[--foo=bar])
47+
end
48+
4349
it 'sets the proxy capabilitiy' do
4450
proxy = Proxy.new(http: 'localhost:1234')
4551
Driver.new(http_client: http, proxy: proxy)

0 commit comments

Comments
 (0)