aboutsummaryrefslogtreecommitdiff
path: root/spec/classes/samba__server__service_spec.rb
blob: 4352ec2dd5470afbd845980d7452ba6ebf2e2d00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'spec_helper'

describe 'samba::server::service' do
  context 'on a Debian os family' do
    let(:facts) {{ :osfamily => 'Debian' }}

    it { should contain_service('samba').with_require('Class[Samba::Server::Config]') }

    context 'Debian' do
      context 'wheezy' do
        let(:facts) {{ :osfamily => 'Debian',
                       :operatingsystem => 'Debian',
                       :operatingsystemmajrelease => '7' }}
        it { should contain_service('samba') }
      end
      context 'jessie' do
        let(:facts) {{ :osfamily => 'Debian',
                       :operatingsystem => 'Debian',
                       :operatingsystemmajrelease => '8' }}
        it { should contain_service('smbd') }
      end
    end

    context 'Ubuntu' do
      let(:facts) {{ :osfamily => 'Debian', :operatingsystem => 'Ubuntu' }}
      it { should contain_service('smbd') }
    end
  end

  context 'on a Redhat os family' do
    let(:facts) {{ :osfamily => 'Redhat' }}
    it { should contain_service('smb') }
  end

  context 'on a Archlinux os family' do
    let(:facts) {{ :osfamily => 'Archlinux' }}
    it { should contain_service('smbd') }
  end

  context 'on Linux os family' do
    let(:facts) {{ :osfamily => 'Linux' }}
    it { should raise_error(/is not supported by this module./) }

    context 'Gentoo' do
      let(:facts) {{ :osfamily => 'Linux', :operatingsystem => 'Gentoo' }}
      it { should contain_service('samba') }
    end
  end

  context 'on an unsupported OS' do
    let(:facts) {{ :osfamily => 'Solaris' }}
    it { should raise_error(/Solaris is not supported by this module./) }
  end
end