Skip to content

Commit c5b1dd2

Browse files
committed
add unit test for the param nocheckcertificate
1 parent de88fd8 commit c5b1dd2

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

spec/unit/classes/selenium_spec.rb

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
shared_examples 'selenium' do |params|
66
# XXX need to test $url
77
p = {
8-
:user => 'selenium',
9-
:group => 'selenium',
10-
:install_root => '/opt/selenium',
11-
:java => 'java',
12-
:version => DEFAULT_VERSION,
13-
:url => '',
14-
:download_timeout => '90',
8+
:user => 'selenium',
9+
:group => 'selenium',
10+
:install_root => '/opt/selenium',
11+
:java => 'java',
12+
:version => DEFAULT_VERSION,
13+
:url => '',
14+
:download_timeout => '90',
15+
:nocheckcertificate => false,
1516
}
1617

1718
if params
@@ -52,10 +53,11 @@
5253
'target' => "#{p[:install_root]}/log",
5354
})
5455
should contain_wget__fetch('selenium-server-standalone').with({
55-
'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar",
56-
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
57-
'timeout' => p[:download_timeout],
58-
'execuser' => p[:user],
56+
'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar",
57+
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
58+
'timeout' => p[:download_timeout],
59+
'nocheckcertificate' => p[:nocheckcertificate],
60+
'execuser' => p[:user],
5961
})
6062
should contain_logrotate__rule('selenium').with({
6163
:path => "#{p[:install_root]}/log",
@@ -166,6 +168,24 @@
166168
}.to raise_error
167169
end
168170
end
171+
172+
context 'nocheckcertificate => true' do
173+
p = { :nocheckcertificate => true }
174+
let(:params) { p }
175+
176+
it_behaves_like 'selenium', p
177+
end
178+
179+
context 'nocheckcertificate => []' do
180+
p = { :nocheckcertificate => [] }
181+
let(:params) { p }
182+
183+
it 'should fail' do
184+
expect {
185+
should contain_class('selenium')
186+
}.to raise_error
187+
end
188+
end
169189
end
170190

171191
end

0 commit comments

Comments
 (0)