diff options
| author | Tomas Barton <barton.tomas@gmail.com> | 2014-01-26 11:19:11 +0100 | 
|---|---|---|
| committer | Tomas Barton <barton.tomas@gmail.com> | 2014-01-26 18:26:34 +0100 | 
| commit | 035161ef168ca331bc47548af87ee872f550c33d (patch) | |
| tree | 6522476c51f239c2cffdfab5511635f1a4f7eff1 /spec/classes | |
| parent | 78f1ff00d09d0ebf8f132e70444b9bcf030b6711 (diff) | |
| download | puppet-sshd-035161ef168ca331bc47548af87ee872f550c33d.tar.gz puppet-sshd-035161ef168ca331bc47548af87ee872f550c33d.tar.bz2 | |
basic init class specs
Diffstat (limited to 'spec/classes')
| -rw-r--r-- | spec/classes/init_spec.rb | 92 | 
1 files changed, 92 insertions, 0 deletions
| diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index c1d9b6f..794a92e 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -7,6 +7,21 @@ describe 'sshd' do      it { should compile.with_all_deps }      it { should contain_class('sshd') }      it { should contain_class('sshd::client') } + +    it { should contain_service('sshd').with( +      :ensure     => 'running', +      :enable     => true, +      :hasstatus  => true, +    )} + +    it { should contain_file('sshd_config').with( +      { +        'ensure'  => 'present', +        'owner'   => 'root', +        'group'   => '0', +        'mode'    => '0600', +      } +    )}    end    context "Debian OS" do @@ -19,6 +34,83 @@ describe 'sshd' do      end      it_behaves_like "a Linux OS"      it { should contain_package('lsb-release') } +    it { should contain_package('openssh') } +    it { should contain_class('sshd::debian') } +    it { should contain_service('sshd').with( +      :hasrestart => true +    )} + +    context "Ubuntu" do +      let :facts do +        { +          :operatingsystem => 'Ubuntu', +          :lsbdistcodename => 'precise', +        } +      end +      it_behaves_like "a Linux OS" +      it { should contain_package('lsb-release') } +      it { should contain_package('openssh') } +      it { should contain_service('sshd').with( +        :hasrestart => true +      )} +    end    end + +#  context "RedHat OS" do +#    it_behaves_like "a Linux OS" do +#      let :facts do +#        { +#          :operatingsystem => 'RedHat', +#          :osfamily        => 'RedHat', +#        } +#      end +#    end +#  end + +  context "CentOS" do +    it_behaves_like "a Linux OS" do +      let :facts do +        { +        :operatingsystem => 'CentOS', +        :osfamily        => 'RedHat', +        :lsbdistcodename => 'Final', +       } +      end +    end +  end + +  context "Gentoo" do +    let :facts do +    { +      :operatingsystem => 'Gentoo', +      :osfamily        => 'Gentoo', +    } +    end +    it_behaves_like "a Linux OS" +    it { should contain_class('sshd::gentoo') } +  end + +  context "OpenBSD" do +    let :facts do +      { +      :operatingsystem => 'OpenBSD', +      :osfamily        => 'OpenBSD', +     } +    end +    it_behaves_like "a Linux OS" +    it { should contain_class('sshd::openbsd') } +  end + +#  context "FreeBSD" do +#    it_behaves_like "a Linux OS" do +#      let :facts do +#        { +#        :operatingsystem => 'FreeBSD', +#        :osfamily        => 'FreeBSD', +#       } +#      end +#    end +#  end +  end
\ No newline at end of file | 
