From 168c9f5417a125f02ad0ecfba555aae15979f3f2 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Thu, 25 Jan 2024 16:40:31 -0600 Subject: [PATCH] [rb] make suggested updates from rubocop --- rb/lib/selenium/webdriver/bidi/log_inspector.rb | 12 ++++++------ rb/lib/selenium/webdriver/common/zipper.rb | 4 ++-- .../webdriver/devtools/network_interceptor.rb | 4 ++-- rb/spec/unit/selenium/webdriver/wait_spec.rb | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rb/lib/selenium/webdriver/bidi/log_inspector.rb b/rb/lib/selenium/webdriver/bidi/log_inspector.rb index 76853d785bf97..1613e027ef774 100644 --- a/rb/lib/selenium/webdriver/bidi/log_inspector.rb +++ b/rb/lib/selenium/webdriver/bidi/log_inspector.rb @@ -50,28 +50,28 @@ def initialize(driver, browsing_context_ids = nil) @bidi.session.subscribe('log.entryAdded', browsing_context_ids) end - def on_console_entry(filter_by = nil, &block) + def on_console_entry(...) check_valid_filter(filter_by) on_log do |params| type = params['type'] - console_log_events(params, filter_by, &block) if type.eql?('console') + console_log_events(params, filter_by, ...) if type.eql?('console') end end - def on_javascript_log(filter_by = nil, &block) + def on_javascript_log(...) check_valid_filter(filter_by) on_log do |params| type = params['type'] - javascript_log_events(params, filter_by, &block) if type.eql?('javascript') + javascript_log_events(params, filter_by, ...) if type.eql?('javascript') end end - def on_javascript_exception(&block) + def on_javascript_exception(...) on_log do |params| type = params['type'] - javascript_log_events(params, FilterBy.log_level('error'), &block) if type.eql?('javascript') + javascript_log_events(params, ...) if type.eql?('javascript') end end diff --git a/rb/lib/selenium/webdriver/common/zipper.rb b/rb/lib/selenium/webdriver/common/zipper.rb index d464df500ad9d..6dd0aaf931324 100644 --- a/rb/lib/selenium/webdriver/common/zipper.rb +++ b/rb/lib/selenium/webdriver/common/zipper.rb @@ -71,11 +71,11 @@ def zip_file(path) private - def with_tmp_zip(&blk) + def with_tmp_zip(...) # Don't use Tempfile since it lacks rb_file_s_rename permission on Windows. Dir.mktmpdir do |tmp_dir| zip_path = File.join(tmp_dir, 'webdriver-zip') - Zip::File.open(zip_path, Zip::File::CREATE, &blk) + Zip::File.open(zip_path, ...) end end diff --git a/rb/lib/selenium/webdriver/devtools/network_interceptor.rb b/rb/lib/selenium/webdriver/devtools/network_interceptor.rb index ccdd8e4417790..8391b3e6ccab4 100644 --- a/rb/lib/selenium/webdriver/devtools/network_interceptor.rb +++ b/rb/lib/selenium/webdriver/devtools/network_interceptor.rb @@ -43,9 +43,9 @@ def initialize(devtools) @lock = Mutex.new end - def intercept(&block) + def intercept(...) devtools.network.on(:loading_failed) { |params| track_cancelled_request(params) } - devtools.fetch.on(:request_paused) { |params| request_paused(params, &block) } + devtools.fetch.on(:request_paused) { |params| request_paused(params, ...) } devtools.network.set_cache_disabled(cache_disabled: true) devtools.network.enable diff --git a/rb/spec/unit/selenium/webdriver/wait_spec.rb b/rb/spec/unit/selenium/webdriver/wait_spec.rb index ec91617f80210..e7887698e98df 100644 --- a/rb/spec/unit/selenium/webdriver/wait_spec.rb +++ b/rb/spec/unit/selenium/webdriver/wait_spec.rb @@ -51,7 +51,7 @@ def wait(*args) expect(wait.until(&block)).to be true end - it 'will use the message from any NoSuchElementError raised while waiting' do + it 'uses the message from any NoSuchElementError raised while waiting' do block = -> { raise Error::NoSuchElementError, 'foo' } expect {