@@ -78,18 +78,18 @@ def stub_binary(binary)
7878
7979 describe 'self.driver_path' do
8080 it 'determines browser name by default' do
81- allow ( described_class ) . to receive ( :run )
81+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
8282 allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
8383 allow ( Platform ) . to receive ( :assert_executable )
8484
8585 described_class . driver_path ( Options . chrome )
8686
8787 expect ( described_class ) . to have_received ( :run )
88- . with ( 'selenium-manager' , '--browser' , 'chrome' , '--output' , 'json' )
88+ . with ( 'selenium-manager' , '--browser' , 'chrome' )
8989 end
9090
9191 it 'uses browser version if specified' do
92- allow ( described_class ) . to receive ( :run )
92+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
9393 allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
9494 allow ( Platform ) . to receive ( :assert_executable )
9595 options = Options . chrome ( browser_version : 1 )
@@ -99,13 +99,12 @@ def stub_binary(binary)
9999 expect ( described_class ) . to have_received ( :run )
100100 . with ( 'selenium-manager' ,
101101 '--browser' , 'chrome' ,
102- '--output' , 'json' ,
103102 '--browser-version' , 1 )
104103 end
105104
106105 it 'uses proxy if specified' do
107106 proxy = Selenium ::WebDriver ::Proxy . new ( ssl : 'proxy' )
108- allow ( described_class ) . to receive ( :run )
107+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
109108 allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
110109 allow ( Platform ) . to receive ( :assert_executable )
111110 options = Options . chrome ( proxy : proxy )
@@ -115,34 +114,43 @@ def stub_binary(binary)
115114 expect ( described_class ) . to have_received ( :run )
116115 . with ( 'selenium-manager' ,
117116 '--browser' , 'chrome' ,
118- '--output' , 'json' ,
119117 '--proxy' , 'proxy' )
120118 end
121119
122120 it 'uses browser location if specified' do
123- allow ( described_class ) . to receive ( :run )
121+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
124122 allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
125123 allow ( Platform ) . to receive ( :assert_executable )
126124 options = Options . chrome ( binary : '/path/to/browser' )
127125
128126 described_class . driver_path ( options )
129127
130128 expect ( described_class ) . to have_received ( :run )
131- . with ( 'selenium-manager' , '--browser' , 'chrome' , '--output' , 'json' , '-- browser-path', '/path/to/browser' )
129+ . with ( 'selenium-manager' , '--browser' , 'chrome' , '--browser-path' , '/path/to/browser' )
132130 end
133131
134132 it 'properly escapes plain spaces in browser location' do
135- allow ( described_class ) . to receive ( :run )
133+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => 'a' , 'driver_path' => '' )
136134 allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
137135 allow ( Platform ) . to receive ( :assert_executable )
138136 options = Options . chrome ( binary : '/path to/the/browser' )
139137
140138 described_class . driver_path ( options )
141139
142140 expect ( described_class ) . to have_received ( :run )
143- . with ( 'selenium-manager' , '--browser' , 'chrome' , '--output' , 'json' ,
141+ . with ( 'selenium-manager' , '--browser' , 'chrome' ,
144142 '--browser-path' , '/path to/the/browser' )
145143 end
144+
145+ it 'sets binary location on options' do
146+ allow ( described_class ) . to receive ( :run ) . and_return ( 'browser_path' => 'foo' , 'driver_path' => '' )
147+ allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
148+ allow ( Platform ) . to receive ( :assert_executable )
149+ options = Options . chrome
150+
151+ described_class . driver_path ( options )
152+ expect ( options . binary ) . to eq 'foo'
153+ end
146154 end
147155 end
148156 end # WebDriver
0 commit comments