2012-03-16 18:36:12 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2013-07-19 21:03:42 +02:00
|
|
|
describe 'mysql::bindings::python' do
|
2012-03-16 18:36:12 +01:00
|
|
|
|
|
|
|
describe 'on a debian based os' do
|
|
|
|
let :facts do
|
2013-07-08 11:49:30 +02:00
|
|
|
{ :osfamily => 'Debian', :root_home => '/root'}
|
2012-03-16 18:36:12 +01:00
|
|
|
end
|
|
|
|
it { should contain_package('python-mysqldb').with(
|
|
|
|
:name => 'python-mysqldb',
|
|
|
|
:ensure => 'present'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2012-05-10 06:55:16 +02:00
|
|
|
describe 'on a freebsd based os' do
|
|
|
|
let :facts do
|
2013-07-08 11:49:30 +02:00
|
|
|
{ :osfamily => 'FreeBSD', :root_home => '/root'}
|
2012-05-10 06:55:16 +02:00
|
|
|
end
|
|
|
|
it { should contain_package('python-mysqldb').with(
|
|
|
|
:name => 'databases/py-MySQLdb',
|
|
|
|
:ensure => 'present'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2012-03-16 18:36:12 +01:00
|
|
|
describe 'on a redhat based os' do
|
|
|
|
let :facts do
|
2013-07-08 11:49:30 +02:00
|
|
|
{:osfamily => 'RedHat', :root_home => '/root'}
|
2012-03-16 18:36:12 +01:00
|
|
|
end
|
|
|
|
it { should contain_package('python-mysqldb').with(
|
|
|
|
:name => 'MySQL-python',
|
|
|
|
:ensure => 'present'
|
|
|
|
)}
|
|
|
|
describe 'when parameters are supplied' do
|
|
|
|
let :params do
|
|
|
|
{:package_ensure => 'latest', :package_name => 'python-mysql'}
|
|
|
|
end
|
|
|
|
it { should contain_package('python-mysqldb').with(
|
|
|
|
:name => 'python-mysql',
|
|
|
|
:ensure => 'latest'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on any other os' do
|
|
|
|
let :facts do
|
2013-07-08 11:49:30 +02:00
|
|
|
{:osfamily => 'foo', :root_home => '/root'}
|
2012-03-16 18:36:12 +01:00
|
|
|
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
|