From ad8c66a065626558d0e46085a0f30724a2339681 Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Sun, 20 Oct 2013 21:27:15 -0400 Subject: [PATCH 1/4] fix specs to cater for PR #162 --- spec/defines/nginx__resource__vhost_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/defines/nginx__resource__vhost_spec.rb b/spec/defines/nginx__resource__vhost_spec.rb index ff17db706..315694cc9 100644 --- a/spec/defines/nginx__resource__vhost_spec.rb +++ b/spec/defines/nginx__resource__vhost_spec.rb @@ -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 From a24e160024ff037706260321f79118319337ef74 Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Sun, 20 Oct 2013 21:28:15 -0400 Subject: [PATCH 2/4] fix specs for PR #158 --- spec/classes/package_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/classes/package_spec.rb b/spec/classes/package_spec.rb index 5c53b52ba..251c8b5de 100644 --- a/spec/classes/package_spec.rb +++ b/spec/classes/package_spec.rb @@ -5,9 +5,6 @@ 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 @@ -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 From 0da2fa17eaef69d3b8fe6a7547012f84b06124f3 Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Sun, 20 Oct 2013 21:43:33 -0400 Subject: [PATCH 3/4] apt modules relies on lsbdistcodename fact --- spec/classes/nginx_spec.rb | 2 +- spec/classes/package_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/classes/nginx_spec.rb b/spec/classes/nginx_spec.rb index aac7fcc87..2580b88a0 100644 --- a/spec/classes/nginx_spec.rb +++ b/spec/classes/nginx_spec.rb @@ -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', diff --git a/spec/classes/package_spec.rb b/spec/classes/package_spec.rb index 251c8b5de..313b52cec 100644 --- a/spec/classes/package_spec.rb +++ b/spec/classes/package_spec.rb @@ -8,8 +8,8 @@ it { should contain_yumrepo('nginx-release').with_enabled('1') } end - shared_examples 'debian' do |operatingsystem| - let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian'}} + shared_examples 'debian' do |operatingsystem, lsbdistcodename| + let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian', :lsbdistcodename => lsbdistcodename }} it { should contain_file('/etc/apt/sources.list.d/nginx.list') } end @@ -32,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 From 3959823171ebdd2e587948edbdceee3deca5235d Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Sun, 20 Oct 2013 21:54:32 -0400 Subject: [PATCH 4/4] check apt::source in catalog, not the file it creates We should trust the apt module to do the right thing, and just test that apt::source is part of the catalogue. --- spec/classes/package_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/package_spec.rb b/spec/classes/package_spec.rb index 313b52cec..6b2d7f8ac 100644 --- a/spec/classes/package_spec.rb +++ b/spec/classes/package_spec.rb @@ -10,7 +10,7 @@ shared_examples 'debian' do |operatingsystem, lsbdistcodename| let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian', :lsbdistcodename => lsbdistcodename }} - it { should contain_file('/etc/apt/sources.list.d/nginx.list') } + it { should contain_apt__source('nginx') } end shared_examples 'suse' do |operatingsystem|