summaryrefslogtreecommitdiff
path: root/spec/classes/base_spec.rb
blob: 7f288eca1712a13df3abacf0ab484da8f379db19 (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
require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper'))

describe 'tor::base', :type => 'class' do
  let(:default_facts) {
    {
      :osfamily        => 'RedHat',
      :operatingsystem => 'CentOS',
    }
  }
  let(:facts){ default_facts }
  let(:pre_condition){'include ::tor
                       Exec{path => "/bin"}' }
  describe 'with standard' do
    it { is_expected.to compile.with_all_deps }

    it { is_expected.to contain_package('tor').with_ensure('installed') }
    it { is_expected.to_not contain_package('tor-geoipdb').with_ensure('installed') }
    it { is_expected.to contain_service('tor').with(
      :ensure     => 'running',
      :enable     => 'true',
      :hasrestart => 'true',
      :hasstatus  => 'true',
      :require    => 'Package[tor]',
    ) }
    context 'on Debian' do
      let(:facts) {
        {
          :osfamily        => 'Debian',
          :operatingsystem => 'Debian',
        }
      }
      it { is_expected.to compile.with_all_deps }
      it { is_expected.to contain_package('tor').with_ensure('installed') }
      it { is_expected.to contain_package('tor-geoipdb').with_ensure('installed') }
      it { is_expected.to contain_service('tor').with(
        :ensure     => 'running',
        :enable     => 'true',
        :hasrestart => 'true',
        :hasstatus  => 'true',
        :require    => 'Package[tor]',
      ) }
    end
  end
end