2012-03-16 18:36:12 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'mysql::ruby' do
|
|
|
|
|
|
|
|
describe 'on a debian based os' do
|
|
|
|
let :facts do
|
|
|
|
{ :osfamily => 'Debian'}
|
|
|
|
end
|
|
|
|
it { should contain_package('ruby_mysql').with(
|
|
|
|
:name => 'libmysql-ruby',
|
|
|
|
:ensure => 'present',
|
|
|
|
# TODO is this what we want? does this actually work
|
|
|
|
# if the provider is blank
|
|
|
|
:provider => ''
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2012-05-10 06:55:16 +02:00
|
|
|
describe 'on a freebsd based os' do
|
|
|
|
let :facts do
|
|
|
|
{ :osfamily => 'FreeBSD'}
|
|
|
|
end
|
|
|
|
it { should contain_package('ruby_mysql').with(
|
|
|
|
:name => 'ruby-mysql',
|
|
|
|
:ensure => 'present',
|
|
|
|
:provider => 'gem'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2012-03-16 18:36:12 +01:00
|
|
|
describe 'on a redhat based os' do
|
|
|
|
let :facts do
|
2012-11-06 15:13:31 +01:00
|
|
|
{:osfamily => 'RedHat'}
|
2012-03-16 18:36:12 +01:00
|
|
|
end
|
|
|
|
it { should contain_package('ruby_mysql').with(
|
|
|
|
:name => 'ruby-mysql',
|
|
|
|
:ensure => 'present',
|
|
|
|
:provider => 'gem'
|
|
|
|
)}
|
|
|
|
describe 'when parameters are supplied' do
|
|
|
|
let :params do
|
|
|
|
{:package_ensure => 'latest',
|
|
|
|
:package_provider => 'zypper',
|
|
|
|
:package_name => 'mysql_ruby'}
|
|
|
|
end
|
|
|
|
it { should contain_package('ruby_mysql').with(
|
|
|
|
:name => 'mysql_ruby',
|
|
|
|
:ensure => 'latest',
|
|
|
|
:provider => 'zypper'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on any other os' do
|
|
|
|
let :facts do
|
|
|
|
{:osfamily => 'foo'}
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should fail' do
|
2012-07-24 01:39:37 +02:00
|
|
|
expect { subject }.to raise_error(/Unsupported osfamily: foo/)
|
2012-03-16 18:36:12 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|