add relationship matchers

This commit is contained in:
Matthew Haughton 2013-12-07 15:36:50 -05:00
parent fb46e3b8cb
commit 17baf0861c
2 changed files with 16 additions and 3 deletions

View file

@ -10,9 +10,14 @@ describe 'nginx' do
end
shared_examples "a Linux OS" do
it { should contain_nginx__package }
it { should contain_nginx__config }
it { should contain_nginx__service }
it { should contain_class('nginx') }
it { should contain_anchor('nginx::begin') }
it { should contain_nginx__package.that_requires('Anchor[nginx::begin]') }
it { should contain_nginx__config.that_requires('Class[nginx::package]') }
it { should contain_nginx__service.that_subscribes_to('Anchor[nginx::begin]') }
it { should contain_nginx__service.that_subscribes_to('Class[nginx::package]') }
it { should contain_nginx__service.that_subscribes_to('Class[nginx::config]') }
it { should contain_anchor('nginx::end').that_requires('Class[nginx::service]') }
it { should contain_class("nginx::params") }
it { should contain_nginx__resource__upstream("upstream1") }
it { should contain_nginx__resource__vhost("test2.local") }

View file

@ -16,6 +16,8 @@ describe 'nginx::package' do
'gpgkey' => 'http://nginx.org/keys/nginx_signing.key'
)}
it { should contain_file('/etc/yum.repos.d/nginx-release.repo') }
it { should contain_anchor('nginx::package::begin').that_comes_before('Class[nginx::package::redhat]') }
it { should contain_anchor('nginx::package::end').that_requires('Class[nginx::package::redhat]') }
end
context "manage_repo => false" do
@ -58,6 +60,8 @@ describe 'nginx::package' do
'key' => '7BD9BF62',
'key_source' => 'http://nginx.org/keys/nginx_signing.key'
)}
it { should contain_anchor('nginx::package::begin').that_comes_before('Class[nginx::package::debian]') }
it { should contain_anchor('nginx::package::end').that_requires('Class[nginx::package::debian]') }
end
context "package_source => 'passenger'" do
@ -104,6 +108,8 @@ describe 'nginx::package' do
].each do |package|
it { should contain_package("#{package}") }
end
it { should contain_anchor('nginx::package::begin').that_comes_before('Class[nginx::package::suse]') }
it { should contain_anchor('nginx::package::end').that_requires('Class[nginx::package::suse]') }
end
@ -137,6 +143,8 @@ describe 'nginx::package' do
'gpgkey' => 'http://nginx.org/keys/nginx_signing.key'
)}
it { should contain_file('/etc/yum.repos.d/nginx-release.repo') }
it { should contain_anchor('nginx::package::begin').that_comes_before('Class[nginx::package::redhat]') }
it { should contain_anchor('nginx::package::end').that_requires('Class[nginx::package::redhat]') }
end
context 'fedora' do