Merge pull request #165 from 3flex/rspec-fixes

Rspec fixes
This commit is contained in:
James Fryman 2013-10-25 07:25:09 -07:00
commit 3587c83255
3 changed files with 8 additions and 14 deletions

View file

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'nginx' do
shared_examples 'linux' do |operatingsystem, user|
let(:facts) {{ :kernel => 'linux', :operatingsystem => operatingsystem, :osfamily => operatingsystem }}
let(:facts) {{ :kernel => 'linux', :operatingsystem => operatingsystem, :osfamily => operatingsystem, :lsbdistcodename => 'precise' }}
it { should contain_service('nginx').with(
:ensure => 'running',

View file

@ -5,15 +5,12 @@ describe 'nginx::package' do
shared_examples 'redhat' do |operatingsystem|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }}
it { should contain_package('nginx') }
it { should contain_package('gd') }
it { should contain_package('libXpm') }
it { should contain_package('libxslt') }
it { should contain_yumrepo('nginx-release').with_enabled('1') }
end
shared_examples 'debian' do |operatingsystem|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian'}}
it { should contain_file('/etc/apt/sources.list.d/nginx.list') }
shared_examples 'debian' do |operatingsystem, lsbdistcodename|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian', :lsbdistcodename => lsbdistcodename }}
it { should contain_apt__source('nginx') }
end
shared_examples 'suse' do |operatingsystem|
@ -35,8 +32,8 @@ describe 'nginx::package' do
end
context 'debian' do
it_behaves_like 'debian', 'debian'
it_behaves_like 'debian', 'ubuntu'
it_behaves_like 'debian', 'debian', 'wheezy'
it_behaves_like 'debian', 'ubuntu', 'precise'
end
context 'suse' do
@ -54,9 +51,6 @@ describe 'nginx::package' do
# including nginx-release
let(:facts) {{ :operatingsystem => 'Fedora', :osfamily => 'RedHat' }}
it { should contain_package('nginx') }
it { should contain_package('gd') }
it { should contain_package('libXpm') }
it { should contain_package('libxslt') }
it { should_not contain_yumrepo('nginx-release') }
end

View file

@ -11,12 +11,12 @@ describe 'nginx::resource::vhost' do
}}
it 'applies location_allow rules' do
should contain_file('/nginx.d/test-500-test-default').with({
should contain_file('/nginx.d/test-500-_').with({
'content' => /allow 10.0.0.1\n allow host1/
})
end
it 'applies location_deny rules' do
should contain_file('/nginx.d/test-500-test-default').with({
should contain_file('/nginx.d/test-500-_').with({
'content' => /deny host2\n deny 10.0.0.2/
})
end