From f7e5b4502571ebfd3e5e0503d33605e2d16e9d67 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Wed, 22 Nov 2023 17:08:45 -0600 Subject: [PATCH] [rb] update with linter fixes --- rb/Gemfile.lock | 9 +++--- rb/Steepfile | 2 ++ .../webdriver/support/event_firing_bridge.rb | 4 +-- .../selenium/webdriver/driver_spec.rb | 8 ++--- .../webdriver/spec_support/helpers.rb | 8 ++--- .../spec_support/test_environment.rb | 4 +-- .../webdriver/common/selenium_manager_spec.rb | 31 +++++++++---------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/rb/Gemfile.lock b/rb/Gemfile.lock index 0f4bd72dc42d9..72d9b81969411 100644 --- a/rb/Gemfile.lock +++ b/rb/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/rb/Steepfile b/rb/Steepfile index df470e013c4fa..818a0e794f778 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + target :lib do signature 'sig' # Signature directory check 'lib' # Directory name diff --git a/rb/lib/selenium/webdriver/support/event_firing_bridge.rb b/rb/lib/selenium/webdriver/support/event_firing_bridge.rb index 136ca869e78d0..d82d4a4bfccb0 100644 --- a/rb/lib/selenium/webdriver/support/event_firing_bridge.rb +++ b/rb/lib/selenium/webdriver/support/event_firing_bridge.rb @@ -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 diff --git a/rb/spec/integration/selenium/webdriver/driver_spec.rb b/rb/spec/integration/selenium/webdriver/driver_spec.rb index 5a5e748731c52..e9ebdc0338685 100644 --- a/rb/spec/integration/selenium/webdriver/driver_spec.rb +++ b/rb/spec/integration/selenium/webdriver/driver_spec.rb @@ -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 diff --git a/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb b/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb index ed4ed13f17b9d..ca050fe1c9b00 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb @@ -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) diff --git a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb index debc2d26dd644..eb798d4ceab05 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb @@ -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) diff --git a/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb b/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb index 3910e5b82676e..c115c0ab9715f 100644 --- a/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb +++ b/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb @@ -43,8 +43,7 @@ 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 @@ -52,9 +51,7 @@ def stub_binary(binary) 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 @@ -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) @@ -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) @@ -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) @@ -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') @@ -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') @@ -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