Skip to content

Commit

Permalink
[rb] setting log value does not apply to Safari
Browse files Browse the repository at this point in the history
this is easier than implementing log separately in each of the other service classes
  • Loading branch information
titusfortner committed Jun 3, 2023
1 parent 1a914bf commit b571cd7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rb/lib/selenium/webdriver/safari/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ class Service < WebDriver::Service
DEFAULT_PORT = 7050
EXECUTABLE = 'safaridriver'
SHUTDOWN_SUPPORTED = false

def initialize(path: nil, port: nil, log: nil, args: nil)
raise Error::WebDriverError, 'Safari Service does not support setting log output' if log

super
end

def log=(*)
raise Error::WebDriverError, 'Safari Service does not support setting log output'
end
end # Service
end # Safari
end # WebDriver
Expand Down
13 changes: 13 additions & 0 deletions rb/spec/unit/selenium/webdriver/safari/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module Safari
allow(Platform).to receive(:assert_executable).and_return(true)
end

it 'does not allow log' do
expect {
described_class.new(log: 'anywhere')
}.to raise_exception(Error::WebDriverError, 'Safari Service does not support setting log output')
end

it 'uses default port and nil path' do
service = described_class.new

Expand Down Expand Up @@ -57,6 +63,13 @@ module Safari
expect(service.extra_args).to be_empty
end

it 'does not allow log=' do
service = described_class.new
expect {
service.log = 'anywhere'
}.to raise_exception(Error::WebDriverError, 'Safari Service does not support setting log output')
end

it 'uses provided args' do
allow(Platform).to receive(:find_binary).and_return(service_path)

Expand Down

0 comments on commit b571cd7

Please sign in to comment.