@@ -78,18 +78,18 @@ def stub_binary(binary)
78
78
79
79
describe 'self.driver_path' do
80
80
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' => '' )
82
82
allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
83
83
allow ( Platform ) . to receive ( :assert_executable )
84
84
85
85
described_class . driver_path ( Options . chrome )
86
86
87
87
expect ( described_class ) . to have_received ( :run )
88
- . with ( 'selenium-manager' , '--browser' , 'chrome' , '--output' , 'json' )
88
+ . with ( 'selenium-manager' , '--browser' , 'chrome' )
89
89
end
90
90
91
91
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' => '' )
93
93
allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
94
94
allow ( Platform ) . to receive ( :assert_executable )
95
95
options = Options . chrome ( browser_version : 1 )
@@ -99,13 +99,12 @@ def stub_binary(binary)
99
99
expect ( described_class ) . to have_received ( :run )
100
100
. with ( 'selenium-manager' ,
101
101
'--browser' , 'chrome' ,
102
- '--output' , 'json' ,
103
102
'--browser-version' , 1 )
104
103
end
105
104
106
105
it 'uses proxy if specified' do
107
106
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' => '' )
109
108
allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
110
109
allow ( Platform ) . to receive ( :assert_executable )
111
110
options = Options . chrome ( proxy : proxy )
@@ -115,34 +114,43 @@ def stub_binary(binary)
115
114
expect ( described_class ) . to have_received ( :run )
116
115
. with ( 'selenium-manager' ,
117
116
'--browser' , 'chrome' ,
118
- '--output' , 'json' ,
119
117
'--proxy' , 'proxy' )
120
118
end
121
119
122
120
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' => '' )
124
122
allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
125
123
allow ( Platform ) . to receive ( :assert_executable )
126
124
options = Options . chrome ( binary : '/path/to/browser' )
127
125
128
126
described_class . driver_path ( options )
129
127
130
128
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' )
132
130
end
133
131
134
132
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' => '' )
136
134
allow ( described_class ) . to receive ( :binary ) . and_return ( 'selenium-manager' )
137
135
allow ( Platform ) . to receive ( :assert_executable )
138
136
options = Options . chrome ( binary : '/path to/the/browser' )
139
137
140
138
described_class . driver_path ( options )
141
139
142
140
expect ( described_class ) . to have_received ( :run )
143
- . with ( 'selenium-manager' , '--browser' , 'chrome' , '--output' , 'json' ,
141
+ . with ( 'selenium-manager' , '--browser' , 'chrome' ,
144
142
'--browser-path' , '/path to/the/browser' )
145
143
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
146
154
end
147
155
end
148
156
end # WebDriver
0 commit comments