daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jan 15th, 2014 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [root@puppet classes]# cat opt_spec.rb
  2.  
  3. require 'spec_helper'
  4.  
  5. shared_examples_for 'test /opt existence' do
  6.  
  7.         it do
  8.           should contain_file('/opt').with(
  9.             :ensure => 'directory',
  10.             :mode   => '0755',
  11.             :owner  => 'root',
  12.             :group  => 'root',
  13.             :before => "Notify[The 'opt' directory exist for Ubuntu & Centos servers.]" )
  14.  
  15.         end
  16.             it { should contain_notify("The 'opt' directory exist for Ubuntu & Centos servers.") }
  17.  
  18.                   context 'centos' do
  19.                        let(:facts) {{ :operatingsystem => 'Centos' }}
  20.                           it_should_behave_like 'test /opt existence'
  21.                        end
  22.  
  23.                   context 'redhat' do
  24.                        let(:facts) {{ :operatingsystem => 'RedHat' }}
  25.                           it_should_behave_like 'test /opt existence'
  26.                        end
  27.  
  28.                   context 'other' do
  29.                        let(:facts) {{ :operatingsystem => 'Ubuntu' }}
  30.                           it { should_not contain_file('/op') }
  31.                        end
  32. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top