02c4da48a5
PHP libraries are required by many apps. This class assumes 'normal' names for these packages, but allows other packages names to be passed for variances such as 'php53-mysql' on RedHat and FreeBSD.
54 lines
1.2 KiB
Ruby
54 lines
1.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'mysql::php' do
|
|
|
|
describe 'on a debian based os' do
|
|
let :facts do
|
|
{ :osfamily => 'Debian'}
|
|
end
|
|
it { should contain_package('php-mysql').with(
|
|
:name => 'php5-mysql',
|
|
:ensure => 'present'
|
|
)}
|
|
end
|
|
|
|
describe 'on a freebsd based os' do
|
|
let :facts do
|
|
{ :osfamily => 'FreeBSD'}
|
|
end
|
|
it { should contain_package('php-mysql').with(
|
|
:name => 'php5-mysql',
|
|
:ensure => 'present'
|
|
)}
|
|
end
|
|
|
|
describe 'on a redhat based os' do
|
|
let :facts do
|
|
{:osfamily => 'Redhat'}
|
|
end
|
|
it { should contain_package('php-mysql').with(
|
|
:name => 'php-mysql',
|
|
:ensure => 'present'
|
|
)}
|
|
describe 'when parameters are supplied' do
|
|
let :params do
|
|
{:package_ensure => 'latest', :package_name => 'php53-mysql'}
|
|
end
|
|
it { should contain_package('php-mysql').with(
|
|
:name => 'php53-mysql',
|
|
:ensure => 'latest'
|
|
)}
|
|
end
|
|
end
|
|
|
|
describe 'on any other os' do
|
|
let :facts do
|
|
{:osfamily => 'foo'}
|
|
end
|
|
|
|
it 'should fail' do
|
|
expect { subject }.to raise_error(/Unsupported osfamily: foo/)
|
|
end
|
|
end
|
|
|
|
end
|