Skip to content

Commit 8ac1df0

Browse files
author
Joshua Hoblitt
committed
add validation + rspec of selenium class download_timeout param
1 parent 4c446af commit 8ac1df0

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
validate_string($java)
8989
validate_string($version)
9090
validate_string($url)
91+
validate_string($download_timeout)
9192

9293
include wget
9394

spec/classes/selenium_spec.rb

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
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 => '2.39.0',
13-
:url => '',
8+
:user => 'selenium',
9+
:group => 'selenium',
10+
:install_root => '/opt/selenium',
11+
:java => 'java',
12+
:version => '2.39.0',
13+
:url => '',
14+
:download_timeout => '90',
1415
}
1516

1617
if params
@@ -46,7 +47,7 @@
4647
should contain_wget__fetch('selenium-server-standalone').with({
4748
'source' => "https://selenium.googlecode.com/files/selenium-server-standalone-#{p[:version]}.jar",
4849
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
49-
'timeout' => '90',
50+
'timeout' => p[:download_timeout],
5051
'execuser' => p[:user],
5152
})
5253
should contain_logrotate__rule('selenium').with({
@@ -140,6 +141,24 @@
140141
}.to raise_error
141142
end
142143
end
144+
145+
context 'download_timeout => 42' do
146+
p = { :download_timeout => '42' }
147+
let(:params) { p }
148+
149+
it_behaves_like 'selenium', p
150+
end
151+
152+
context 'download_timeout => []' do
153+
p = { :download_timeout => [] }
154+
let(:params) { p }
155+
156+
it 'should fail' do
157+
expect {
158+
should contain_class('selenium')
159+
}.to raise_error
160+
end
161+
end
143162
end
144163

145164
end

0 commit comments

Comments
 (0)