Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@puppet classes]# cat opt_spec.rb
- require 'spec_helper'
- shared_examples_for 'test /opt existence' do
- it do
- should contain_file('/opt').with(
- :ensure => 'directory',
- :mode => '0755',
- :owner => 'root',
- :group => 'root',
- :before => "Notify[The 'opt' directory exist for Ubuntu & Centos servers.]" )
- end
- it { should contain_notify("The 'opt' directory exist for Ubuntu & Centos servers.") }
- context 'centos' do
- let(:facts) {{ :operatingsystem => 'Centos' }}
- it_should_behave_like 'test /opt existence'
- end
- context 'redhat' do
- let(:facts) {{ :operatingsystem => 'RedHat' }}
- it_should_behave_like 'test /opt existence'
- end
- context 'other' do
- let(:facts) {{ :operatingsystem => 'Ubuntu' }}
- it { should_not contain_file('/op') }
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement