Skip to content

Commit

Permalink
Merge pull request #165 from 3flex/rspec-fixes
Browse files Browse the repository at this point in the history
Rspec fixes
  • Loading branch information
James Fryman committed Oct 25, 2013
2 parents 59cf914 + 3959823 commit 3587c83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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',
Expand Down
16 changes: 5 additions & 11 deletions spec/classes/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
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|
Expand All @@ -35,8 +32,8 @@
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
Expand All @@ -54,9 +51,6 @@
# 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

Expand Down
4 changes: 2 additions & 2 deletions spec/defines/nginx__resource__vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
}}

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
Expand Down

0 comments on commit 3587c83

Please sign in to comment.