Skip to content

Commit

Permalink
[rb] update with linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Nov 22, 2023
1 parent 65b59ae commit f7e5b45
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
9 changes: 5 additions & 4 deletions rb/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GEM
drb (2.2.0)
ruby2_keywords
ffi (1.16.3)
ffi (1.16.3-x64-mingw32)
fileutils (1.7.2)
hashdiff (1.0.1)
i18n (1.14.1)
Expand Down Expand Up @@ -75,7 +76,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbs (3.3.0)
rbs (3.3.2)
abbrev
rdoc (6.6.0)
psych (>= 4.0.0)
Expand Down Expand Up @@ -124,7 +125,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
securerandom (0.3.0)
steep (1.6.0)
steep (1.5.3)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
csv (>= 3.0.9)
Expand Down Expand Up @@ -172,10 +173,10 @@ DEPENDENCIES
rubocop-rspec (~> 2.16)
selenium-devtools!
selenium-webdriver!
steep (~> 1.6.0)
steep (~> 1.5.0)
webmock (~> 3.5)
webrick (~> 1.7)
yard (~> 0.9.11)

BUNDLED WITH
2.4.10
2.3.11
2 changes: 2 additions & 0 deletions rb/Steepfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

target :lib do
signature 'sig' # Signature directory
check 'lib' # Directory name
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/support/event_firing_bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def dispatch(name, *args)
returned
end

def method_missing(meth, *args, &blk) # rubocop:disable Style/MissingRespondToMissing
@delegate.__send__(meth, *args, &blk)
def method_missing(meth, ...) # rubocop:disable Style/MissingRespondToMissing
@delegate.__send__(meth, ...)
end
end # EventFiringBridge
end # Support
Expand Down
8 changes: 4 additions & 4 deletions rb/spec/integration/selenium/webdriver/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ module WebDriver
expect(caps.browser_version).to match(/^\d\d\d?\./)
expect(caps.platform_name).not_to be_nil

expect(caps.accept_insecure_certs).to be == (caps.browser_name == 'firefox')
expect(caps.page_load_strategy).to be == 'normal'
expect(caps.accept_insecure_certs).to eq(caps.browser_name == 'firefox')
expect(caps.page_load_strategy).to eq 'normal'
expect(caps.implicit_timeout).to be_zero
expect(caps.page_load_timeout).to be == 300000
expect(caps.script_timeout).to be == 30000
expect(caps.page_load_timeout).to eq 300000
expect(caps.script_timeout).to eq 30000
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ def driver
GlobalTestEnv.driver_instance
end

def reset_driver!(**opts, &block)
GlobalTestEnv.reset_driver!(**opts, &block)
def reset_driver!(...)
GlobalTestEnv.reset_driver!(...)
end

def quit_driver
GlobalTestEnv.quit_driver
end

def create_driver!(**opts, &block)
GlobalTestEnv.create_driver!(**opts, &block)
def create_driver!(...)
GlobalTestEnv.create_driver!(...)
end

def url_for(filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def browser
end
end

def driver_instance(**opts, &block)
@driver_instance || create_driver!(**opts, &block)
def driver_instance(...)
@driver_instance || create_driver!(...)
end

def reset_driver!(time: 0, **opts, &block)
Expand Down
31 changes: 14 additions & 17 deletions rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@ def stub_binary(binary)
it 'detects Mac' do
stub_binary('/macos/selenium-manager')
allow(Platform).to receive(:assert_file)
allow(Platform).to receive(:windows?).and_return(false)
allow(Platform).to receive(:mac?).and_return(true)
allow(Platform).to receive_messages(windows?: false, mac?: true)

expect(described_class.send(:binary)).to match(%r{/macos/selenium-manager$})
end

it 'detects Linux' do
stub_binary('/linux/selenium-manager')
allow(Platform).to receive(:assert_file)
allow(Platform).to receive(:windows?).and_return(false)
allow(Platform).to receive(:mac?).and_return(false)
allow(Platform).to receive(:linux?).and_return(true)
allow(Platform).to receive_messages(windows?: false, mac?: false, linux?: true)

expect(described_class.send(:binary)).to match(%r{/linux/selenium-manager$})
end
Expand All @@ -78,8 +75,8 @@ def stub_binary(binary)

describe 'self.driver_path' do
it 'determines browser name by default' do
allow(described_class).to receive(:run).and_return('browser_path' => '', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => '', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)

described_class.driver_path(Options.chrome)
Expand All @@ -89,8 +86,8 @@ def stub_binary(binary)
end

it 'uses browser version if specified' do
allow(described_class).to receive(:run).and_return('browser_path' => '', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => '', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)
options = Options.chrome(browser_version: 1)

Expand All @@ -104,8 +101,8 @@ def stub_binary(binary)

it 'uses proxy if specified' do
proxy = Selenium::WebDriver::Proxy.new(ssl: 'proxy')
allow(described_class).to receive(:run).and_return('browser_path' => '', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => '', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)
options = Options.chrome(proxy: proxy)

Expand All @@ -118,8 +115,8 @@ def stub_binary(binary)
end

it 'uses browser location if specified' do
allow(described_class).to receive(:run).and_return('browser_path' => '', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => '', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)
options = Options.chrome(binary: '/path/to/browser')

Expand All @@ -130,8 +127,8 @@ def stub_binary(binary)
end

it 'properly escapes plain spaces in browser location' do
allow(described_class).to receive(:run).and_return('browser_path' => 'a', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => 'a', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)
options = Options.chrome(binary: '/path to/the/browser')

Expand All @@ -143,8 +140,8 @@ def stub_binary(binary)
end

it 'sets binary location on options' do
allow(described_class).to receive(:run).and_return('browser_path' => 'foo', 'driver_path' => '')
allow(described_class).to receive(:binary).and_return('selenium-manager')
allow(described_class).to receive_messages(run: {'browser_path' => 'foo', 'driver_path' => ''},
binary: 'selenium-manager')
allow(Platform).to receive(:assert_executable)
options = Options.chrome

Expand Down

0 comments on commit f7e5b45

Please sign in to comment.