Added tests to mysql::java.
This commit is contained in:
parent
ba4df4dead
commit
0743faa6db
3 changed files with 48 additions and 1 deletions
|
@ -15,7 +15,7 @@ class mysql::java (
|
|||
$package_name = $mysql::params::java_package_name,
|
||||
$package_ensure = 'present'
|
||||
) inherits mysql::params {
|
||||
|
||||
|
||||
package { 'mysql-connector-java':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
|
|
46
spec/classes/mysql_java_spec.rb
Normal file
46
spec/classes/mysql_java_spec.rb
Normal file
|
@ -0,0 +1,46 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::java' do
|
||||
|
||||
describe 'on a debian based os' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian'}
|
||||
end
|
||||
it { should contain_package('mysql-connector-java').with(
|
||||
:name => 'libmysql-java',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on a redhat based os' do
|
||||
let :facts do
|
||||
{:osfamily => 'Redhat'}
|
||||
end
|
||||
it { should contain_package('mysql-connector-java').with(
|
||||
:name => 'mysql-connector-java',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
describe 'when parameters are supplied' do
|
||||
let :params do
|
||||
{:package_ensure => 'latest', :package_name => 'java-mysql'}
|
||||
end
|
||||
it { should contain_package('mysql-connector-java').with(
|
||||
:name => 'java-mysql',
|
||||
:ensure => 'latest'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on any other os' do
|
||||
let :facts do
|
||||
{:osfamily => 'foo'}
|
||||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect do
|
||||
subject
|
||||
end.should raise_error(/Unsupported osfamily: foo/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
1
tests/java.pp
Normal file
1
tests/java.pp
Normal file
|
@ -0,0 +1 @@
|
|||
class { 'mysql::java':}
|
Loading…
Reference in a new issue