Skip to content

Commit

Permalink
[rb] Looks like I added comments that this was deprecated 4 years ago…
Browse files Browse the repository at this point in the history
…, but never actually added deprecation warnings to the code

Probably fine to just delete all of this, but I'll mark it deprecated to be safe
  • Loading branch information
titusfortner committed Dec 12, 2022
1 parent 79035ba commit ebe1ec1
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver/chrome/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Service < WebDriver::Service

private

# NOTE: This processing is deprecated
def extract_service_args(driver_opts)
driver_args = super
driver_opts = driver_opts.dup
Expand Down
3 changes: 3 additions & 0 deletions rb/lib/selenium/webdriver/common/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def shutdown_supported
protected

def extract_service_args(driver_opts)
WebDriver.logger.deprecate("initializing Service class with :args using Hash",
":args parameter with an Array of String values",
id: :driver_opts)
driver_opts.key?(:args) ? driver_opts.delete(:args) : []
end

Expand Down
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver/firefox/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Service < WebDriver::Service

private

# NOTE: This processing is deprecated
def extract_service_args(driver_opts)
driver_args = super
driver_opts = driver_opts.dup
Expand Down
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver/ie/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Service < WebDriver::Service

private

# NOTE: This processing is deprecated
def extract_service_args(driver_opts)
driver_args = super
driver_opts = driver_opts.dup
Expand Down
9 changes: 5 additions & 4 deletions rb/spec/unit/selenium/webdriver/chrome/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ module WebDriver
expect(service.extra_args).to eq ['--foo', '--bar']
end

# This is deprecated behavior
it 'uses args when passed in as a Hash' do
allow(Platform).to receive(:find_binary).and_return(service_path)

service = Service.chrome(args: {log_path: '/path/to/log',
verbose: true})
expect {
service = Service.chrome(args: {log_path: '/path/to/log',
verbose: true})

expect(service.extra_args).to eq ['--log-path=/path/to/log', '--verbose']
expect(service.extra_args).to eq ['--log-path=/path/to/log', '--verbose']
}.to have_deprecated(:driver_opts)
end
end

Expand Down
8 changes: 5 additions & 3 deletions rb/spec/unit/selenium/webdriver/edge/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ module WebDriver
it 'uses args when passed in as a Hash' do
allow(Platform).to receive(:find_binary).and_return(service_path)

service = Service.edge(args: {log_path: '/path/to/log',
verbose: true})
expect {
service = Service.edge(args: {log_path: '/path/to/log',
verbose: true})

expect(service.extra_args).to eq ['--log-path=/path/to/log', '--verbose']
expect(service.extra_args).to eq ['--log-path=/path/to/log', '--verbose']
}.to have_deprecated(:driver_opts)
end
end

Expand Down
9 changes: 5 additions & 4 deletions rb/spec/unit/selenium/webdriver/firefox/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ module WebDriver
expect(service.extra_args).to eq ['--foo', '--bar']
end

# This is deprecated behavior
it 'uses args when passed in as a Hash' do
allow(Platform).to receive(:find_binary).and_return(service_path)

service = Service.firefox(args: {log: '/path/to/log',
marionette_port: 4})
expect {
service = Service.firefox(args: {log: '/path/to/log',
marionette_port: 4})

expect(service.extra_args).to eq ['--log=/path/to/log', '--marionette-port=4']
expect(service.extra_args).to eq ['--log=/path/to/log', '--marionette-port=4']
}.to have_deprecated(:driver_opts)
end
end

Expand Down
8 changes: 5 additions & 3 deletions rb/spec/unit/selenium/webdriver/ie/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ module WebDriver
it 'uses args when passed in as a Hash' do
allow(Platform).to receive(:find_binary).and_return(service_path)

service = Service.ie(args: {log_file: '/path/to/log',
silent: true})
expect {
service = Service.ie(args: {log_file: '/path/to/log',
silent: true})

expect(service.extra_args).to eq ['--log-file=/path/to/log', '--silent']
expect(service.extra_args).to eq ['--log-file=/path/to/log', '--silent']
}.to have_deprecated(:driver_opts)
end
end

Expand Down

0 comments on commit ebe1ec1

Please sign in to comment.