summaryrefslogtreecommitdiff
path: root/spec/hosts/simple_debian_wheezy_spec.rb
blob: f30103824ffde9bb3cc71da6f0b4bb7c890cf84d (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
require 'spec_helper'

describe 'simple_debian_wheezy' do
  let (:facts) { {
    :augeas_lens_dir     => :undef,
    :augeas_ruby_version => :undef,
    :augeas_version      => :undef,
    :lsbdistcodename     => 'wheezy',
    :osfamily            => 'Debian',
    :rubyversion         => '1.9.1',
  } }

  context 'when versions are not specified' do
    it { should contain_package('libaugeas0').with(
      :ensure => 'present'
    ) }
    it { should contain_package('augeas-tools').with(
      :ensure => 'present'
    ) }
    it { should contain_package('augeas-lenses').with(
      :ensure => 'present'
    ) }
    it { should contain_package('ruby-augeas').with(
      :ensure => 'present',
      :name   => 'libaugeas-ruby1.9.1'
    ) }
  end

  context 'when versions are specified' do
    let (:facts) { {
      :osfamily            => 'Debian',
      :lsbdistcodename     => 'wheezy',
      :rubyversion         => '1.9.1',
      :augeas_lens_dir     => :undef,
      :augeas_version      => '1.2.3',
      :augeas_ruby_version => '3.2.1',
    } }

    it { should contain_package('libaugeas0').with(
      :ensure => '1.2.3'
    ) }
    it { should contain_package('augeas-tools').with(
      :ensure => '1.2.3'
    ) }
    it { should contain_package('augeas-lenses').with(
      :ensure => '1.2.3'
    ) }
    it { should contain_package('ruby-augeas').with(
      :ensure => '3.2.1',
      :name   => 'libaugeas-ruby1.9.1'
    ) }
  end

  context 'with standard lens_dir' do
    let (:facts) { {
      :augeas_lens_dir     => :undef,
      :augeas_ruby_version => :undef,
      :augeas_version      => :undef,
      :osfamily            => 'Debian',
      :rubyversion         => '1.9.1',
    } }

    it { should contain_file('/usr/share/augeas/lenses').with(
      :ensure       => 'directory',
      :purge        => 'true',
      :force        => 'true',
      :recurse      => 'true',
      :recurselimit => 1
    ) }
    it { should contain_file('/usr/share/augeas/lenses/dist').with(
      :ensure       => 'directory',
      :purge        => 'false'
    ) }
    it { should contain_file('/usr/share/augeas/lenses/tests').with(
      :ensure       => 'directory',
      :purge        => 'true',
      :force        => 'true'
    ).without(:recurse) }
  end

  context 'with a non standard lens_dir' do
    let (:facts) { {
      :augeas_lens_dir     => '/opt/augeas/lenses',
      :augeas_ruby_version => :undef,
      :augeas_version      => :undef,
      :lsbdistcodename     => 'wheezy',
      :osfamily            => 'Debian',
      :rubyversion         => '1.9.1',
    } }

    it { should contain_file('/opt/augeas/lenses').with(
      :ensure       => 'directory',
      :purge        => 'true',
      :force        => 'true',
      :recurse      => 'true',
      :recurselimit => 1
    ) }
    it { should contain_file('/opt/augeas/lenses/dist').with(
      :ensure       => 'directory',
      :purge        => 'false'
    ) }
    it { should contain_file('/opt/augeas/lenses/tests').with(
      :ensure       => 'directory',
      :purge        => 'true',
      :force        => 'true'
    ).without(:recurse) }
  end
end