Skip to content

Commit

Permalink
add validation + rspec of selenium class download_timeout param
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Jan 16, 2014
1 parent 4c446af commit 8ac1df0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
validate_string($java)
validate_string($version)
validate_string($url)
validate_string($download_timeout)

include wget

Expand Down
33 changes: 26 additions & 7 deletions spec/classes/selenium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
shared_examples 'selenium' do |params|
# XXX need to test $url
p = {
:user => 'selenium',
:group => 'selenium',
:install_root => '/opt/selenium',
:java => 'java',
:version => '2.39.0',
:url => '',
:user => 'selenium',
:group => 'selenium',
:install_root => '/opt/selenium',
:java => 'java',
:version => '2.39.0',
:url => '',
:download_timeout => '90',
}

if params
Expand Down Expand Up @@ -46,7 +47,7 @@
should contain_wget__fetch('selenium-server-standalone').with({
'source' => "https://selenium.googlecode.com/files/selenium-server-standalone-#{p[:version]}.jar",
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
'timeout' => '90',
'timeout' => p[:download_timeout],
'execuser' => p[:user],
})
should contain_logrotate__rule('selenium').with({
Expand Down Expand Up @@ -140,6 +141,24 @@
}.to raise_error
end
end

context 'download_timeout => 42' do
p = { :download_timeout => '42' }
let(:params) { p }

it_behaves_like 'selenium', p
end

context 'download_timeout => []' do
p = { :download_timeout => [] }
let(:params) { p }

it 'should fail' do
expect {
should contain_class('selenium')
}.to raise_error
end
end
end

end

0 comments on commit 8ac1df0

Please sign in to comment.