@@ -43,18 +43,15 @@ def stub_binary(binary)
43
43
it 'detects Mac' do
44
44
stub_binary ( '/macos/selenium-manager' )
45
45
allow ( Platform ) . to receive ( :assert_file )
46
- allow ( Platform ) . to receive ( :windows? ) . and_return ( false )
47
- allow ( Platform ) . to receive ( :mac? ) . and_return ( true )
46
+ allow ( Platform ) . to receive_messages ( windows? : false , mac? : true )
48
47
49
48
expect ( described_class . send ( :binary ) ) . to match ( %r{/macos/selenium-manager$} )
50
49
end
51
50
52
51
it 'detects Linux' do
53
52
stub_binary ( '/linux/selenium-manager' )
54
53
allow ( Platform ) . to receive ( :assert_file )
55
- allow ( Platform ) . to receive ( :windows? ) . and_return ( false )
56
- allow ( Platform ) . to receive ( :mac? ) . and_return ( false )
57
- allow ( Platform ) . to receive ( :linux? ) . and_return ( true )
54
+ allow ( Platform ) . to receive_messages ( windows? : false , mac? : false , linux? : true )
58
55
59
56
expect ( described_class . send ( :binary ) ) . to match ( %r{/linux/selenium-manager$} )
60
57
end
@@ -78,8 +75,8 @@ def stub_binary(binary)
78
75
79
76
describe 'self.driver_path' do
80
77
it 'determines browser name by default' do
81
- allow ( described_class ) . to receive ( : run) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
82
- allow ( described_class ) . to receive ( : binary) . and_return ( 'selenium-manager' )
78
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => '' , 'driver_path' => '' } ,
79
+ binary : 'selenium-manager' )
83
80
allow ( Platform ) . to receive ( :assert_executable )
84
81
85
82
described_class . driver_path ( Options . chrome )
@@ -89,8 +86,8 @@ def stub_binary(binary)
89
86
end
90
87
91
88
it 'uses browser version if specified' do
92
- allow ( described_class ) . to receive ( : run) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
93
- allow ( described_class ) . to receive ( : binary) . and_return ( 'selenium-manager' )
89
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => '' , 'driver_path' => '' } ,
90
+ binary : 'selenium-manager' )
94
91
allow ( Platform ) . to receive ( :assert_executable )
95
92
options = Options . chrome ( browser_version : 1 )
96
93
@@ -104,8 +101,8 @@ def stub_binary(binary)
104
101
105
102
it 'uses proxy if specified' do
106
103
proxy = Selenium ::WebDriver ::Proxy . new ( ssl : 'proxy' )
107
- allow ( described_class ) . to receive ( : run) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
108
- allow ( described_class ) . to receive ( : binary) . and_return ( 'selenium-manager' )
104
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => '' , 'driver_path' => '' } ,
105
+ binary : 'selenium-manager' )
109
106
allow ( Platform ) . to receive ( :assert_executable )
110
107
options = Options . chrome ( proxy : proxy )
111
108
@@ -118,8 +115,8 @@ def stub_binary(binary)
118
115
end
119
116
120
117
it 'uses browser location if specified' do
121
- allow ( described_class ) . to receive ( : run) . and_return ( 'browser_path' => '' , 'driver_path' => '' )
122
- allow ( described_class ) . to receive ( : binary) . and_return ( 'selenium-manager' )
118
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => '' , 'driver_path' => '' } ,
119
+ binary : 'selenium-manager' )
123
120
allow ( Platform ) . to receive ( :assert_executable )
124
121
options = Options . chrome ( binary : '/path/to/browser' )
125
122
@@ -130,8 +127,8 @@ def stub_binary(binary)
130
127
end
131
128
132
129
it 'properly escapes plain spaces in browser location' do
133
- allow ( described_class ) . to receive ( : run) . and_return ( 'browser_path' => 'a' , 'driver_path' => '' )
134
- allow ( described_class ) . to receive ( : binary) . and_return ( 'selenium-manager' )
130
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => 'a' , 'driver_path' => '' } ,
131
+ binary : 'selenium-manager' )
135
132
allow ( Platform ) . to receive ( :assert_executable )
136
133
options = Options . chrome ( binary : '/path to/the/browser' )
137
134
@@ -143,8 +140,8 @@ def stub_binary(binary)
143
140
end
144
141
145
142
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' )
143
+ allow ( described_class ) . to receive_messages ( run : { 'browser_path' => 'foo' , 'driver_path' => '' } ,
144
+ binary : 'selenium-manager' )
148
145
allow ( Platform ) . to receive ( :assert_executable )
149
146
options = Options . chrome
150
147
0 commit comments