From f21e64bcd028855dc94993ac9fd38a41ee810ec1 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Thu, 11 Jan 2024 09:06:43 -0600 Subject: [PATCH] [rb] fix things I've missed --- rb/lib/selenium/webdriver/common/service.rb | 2 +- .../webdriver/common/driver_finder_spec.rb | 16 ++++++++-------- .../webdriver/common/selenium_manager_spec.rb | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rb/lib/selenium/webdriver/common/service.rb b/rb/lib/selenium/webdriver/common/service.rb index b2daa923c1904..02affad04549f 100644 --- a/rb/lib/selenium/webdriver/common/service.rb +++ b/rb/lib/selenium/webdriver/common/service.rb @@ -89,7 +89,7 @@ def initialize(path: nil, port: nil, log: nil, args: nil) def launch @executable_path ||= begin default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new - DriverFinder.result(default_options, self.class)[:driver_path] + DriverFinder.new(default_options, self.class).driver_path end ServiceManager.new(self).tap(&:start) end diff --git a/rb/spec/unit/selenium/webdriver/common/driver_finder_spec.rb b/rb/spec/unit/selenium/webdriver/common/driver_finder_spec.rb index 927eb442c800c..621c4b69d60c4 100644 --- a/rb/spec/unit/selenium/webdriver/common/driver_finder_spec.rb +++ b/rb/spec/unit/selenium/webdriver/common/driver_finder_spec.rb @@ -24,28 +24,28 @@ module WebDriver describe DriverFinder do it 'class path accepts a String without calling Selenium Manager' do allow(Chrome::Service).to receive(:driver_path).and_return('path') - allow(SeleniumManager).to receive(:result) + allow(SeleniumManager).to receive(:binary_paths) allow(Platform).to receive(:assert_executable).with('path').and_return(true) described_class.new(Options.chrome, Service.chrome).driver_path - expect(SeleniumManager).not_to have_received(:result) + expect(SeleniumManager).not_to have_received(:binary_paths) expect(Platform).to have_received(:assert_executable).with('path') end it 'class path accepts a proc without calling Selenium Manager' do allow(Chrome::Service).to receive(:driver_path).and_return(proc { 'path' }) - allow(SeleniumManager).to receive(:result) + allow(SeleniumManager).to receive(:binary_paths) allow(Platform).to receive(:assert_executable).with('path').and_return(true) described_class.new(Options.chrome, Service.chrome).driver_path - expect(SeleniumManager).not_to have_received(:result) + expect(SeleniumManager).not_to have_received(:binary_paths) expect(Platform).to have_received(:assert_executable).with('path') end it 'validates all returned files' do - allow(SeleniumManager).to receive(:result).and_return({'browser_path' => '/path/to/browser', + allow(SeleniumManager).to receive(:binary_paths).and_return({'browser_path' => '/path/to/browser', 'driver_path' => '/path/to/driver'}) allow(Platform).to receive(:assert_executable).with('/path/to/browser').and_return(true) allow(Platform).to receive(:assert_executable).with('/path/to/driver').and_return(true) @@ -57,7 +57,7 @@ module WebDriver end it 'wraps error with NoSuchDriverError' do - allow(SeleniumManager).to receive(:result).and_raise(Error::WebDriverError, 'this error') + allow(SeleniumManager).to receive(:binary_paths).and_raise(Error::WebDriverError, 'this error') expect { expect { @@ -68,7 +68,7 @@ module WebDriver end it 'creates arguments' do - allow(SeleniumManager).to receive(:result).and_return({'browser_path' => '/path/to/browser', + allow(SeleniumManager).to receive(:binary_paths).and_return({'browser_path' => '/path/to/browser', 'driver_path' => '/path/to/driver'}) proxy = instance_double(Proxy, ssl: 'proxy') options = Options.chrome(browser_version: 'stable', proxy: proxy, binary: 'path/to/browser') @@ -77,7 +77,7 @@ module WebDriver described_class.new(options, Service.chrome).driver_path - expect(SeleniumManager).to have_received(:result).with('--browser', + expect(SeleniumManager).to have_received(:binary_paths).with('--browser', options.browser_name, '--browser-version', options.browser_version, 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 6026e8d3db132..d6816c14ac93b 100644 --- a/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb +++ b/rb/spec/unit/selenium/webdriver/common/selenium_manager_spec.rb @@ -94,11 +94,11 @@ module WebDriver end end - describe '.results' do + describe '.binary_paths' do it 'returns exact output from #run' do return_map = {} allow(described_class).to receive_messages(binary: 'binary', run: return_map) - expect(described_class.result('something')).to eq(return_map) + expect(described_class.binary_paths('something')).to eq(return_map) end end end