Skip to content

Commit

Permalink
add unit test for the param nocheckcertificate
Browse files Browse the repository at this point in the history
  • Loading branch information
zivan committed Jan 30, 2015
1 parent de88fd8 commit c5b1dd2
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions spec/unit/classes/selenium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
shared_examples 'selenium' do |params|
# XXX need to test $url
p = {
:user => 'selenium',
:group => 'selenium',
:install_root => '/opt/selenium',
:java => 'java',
:version => DEFAULT_VERSION,
:url => '',
:download_timeout => '90',
:user => 'selenium',
:group => 'selenium',
:install_root => '/opt/selenium',
:java => 'java',
:version => DEFAULT_VERSION,
:url => '',
:download_timeout => '90',
:nocheckcertificate => false,
}

if params
Expand Down Expand Up @@ -52,10 +53,11 @@
'target' => "#{p[:install_root]}/log",
})
should contain_wget__fetch('selenium-server-standalone').with({
'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar",
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
'timeout' => p[:download_timeout],
'execuser' => p[:user],
'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar",
'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar",
'timeout' => p[:download_timeout],
'nocheckcertificate' => p[:nocheckcertificate],
'execuser' => p[:user],
})
should contain_logrotate__rule('selenium').with({
:path => "#{p[:install_root]}/log",
Expand Down Expand Up @@ -166,6 +168,24 @@
}.to raise_error
end
end

context 'nocheckcertificate => true' do
p = { :nocheckcertificate => true }
let(:params) { p }

it_behaves_like 'selenium', p
end

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

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

end

0 comments on commit c5b1dd2

Please sign in to comment.