diff options
author | Micah Anderson <micah@riseup.net> | 2016-11-04 10:54:28 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2016-11-04 10:54:28 -0400 |
commit | 34a381efa8f6295080c843f86bfa07d4e41056af (patch) | |
tree | 9282cf5d4c876688602705a7fa0002bc4a810bde /puppet/modules/augeas/spec/classes/augeas_spec.rb | |
parent | 0a72bc6fd292bf9367b314fcb0347c4d35042f16 (diff) | |
parent | 5821964ff7e16ca7aa9141bd09a77d355db492a9 (diff) |
Merge branch 'develop'
Diffstat (limited to 'puppet/modules/augeas/spec/classes/augeas_spec.rb')
m--------- | puppet/modules/augeas | 0 | ||||
-rw-r--r-- | puppet/modules/augeas/spec/classes/augeas_spec.rb | 149 |
2 files changed, 149 insertions, 0 deletions
diff --git a/puppet/modules/augeas b/puppet/modules/augeas deleted file mode 160000 -Subproject 58ab2b90c52a5d951fa41596827bc3b6f52310e diff --git a/puppet/modules/augeas/spec/classes/augeas_spec.rb b/puppet/modules/augeas/spec/classes/augeas_spec.rb new file mode 100644 index 00000000..ab4241f4 --- /dev/null +++ b/puppet/modules/augeas/spec/classes/augeas_spec.rb @@ -0,0 +1,149 @@ +require 'spec_helper' + +describe 'augeas' do + + context 'when on an unsupported Operating System' do + let (:facts) do + { + :osfamily => 'MS-DOS', + } + end + + it 'should fail' do + expect { is_expected.to contain_package('ruby-augeas') }.to raise_error(Puppet::Error, /Unsupported OS family/) + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts + end + + context 'without params' do + case facts[:osfamily] + when 'Debian' + it { is_expected.to contain_package('libaugeas0').with( + :ensure => 'present' + ) } + it { is_expected.to contain_package('augeas-tools').with( + :ensure => 'present' + ) } + it { is_expected.to contain_package('augeas-lenses').with( + :ensure => 'present' + ) } + case facts[:lsbdistcodename] + when 'squeeze', 'lucid', 'precise' + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => 'present', + :name => 'libaugeas-ruby1.8' + ) } + else + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => 'present', + :name => 'libaugeas-ruby1.9.1' + ) } + end + when 'RedHat' + it { is_expected.to contain_package('augeas').with( + :ensure => 'present' + ) } + it { is_expected.to contain_package('augeas-libs').with( + :ensure => 'present' + ) } + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => 'present', + :name => 'ruby-augeas' + ) } + end + it { is_expected.to contain_file('/usr/share/augeas/lenses').with( + :ensure => 'directory', + :purge => 'true', + :force => 'true', + :recurse => 'true', + :recurselimit => 1 + ) } + it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with( + :ensure => 'directory', + :purge => 'false' + ) } + it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with( + :ensure => 'directory', + :purge => 'true', + :force => 'true' + ).without(:recurse) } + end + + context 'when versions are specified' do + let (:params) do + { + :version => '1.2.3', + :ruby_version => '3.2.1', + } + end + + case facts[:osfamily] + when 'Debian' + it { is_expected.to contain_package('libaugeas0').with( + :ensure => '1.2.3' + ) } + it { is_expected.to contain_package('augeas-tools').with( + :ensure => '1.2.3' + ) } + it { is_expected.to contain_package('augeas-lenses').with( + :ensure => '1.2.3' + ) } + case facts[:lsbdistcodename] + when 'squeeze', 'lucid', 'precise' + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => '3.2.1', + :name => 'libaugeas-ruby1.8' + ) } + else + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => '3.2.1', + :name => 'libaugeas-ruby1.9.1' + ) } + end + when 'RedHat' + it { is_expected.to contain_package('augeas').with( + :ensure => '1.2.3' + ) } + it { is_expected.to contain_package('augeas-libs').with( + :ensure => '1.2.3' + ) } + it { is_expected.to contain_package('ruby-augeas').with( + :ensure => '3.2.1', + :name => 'ruby-augeas' + ) } + end + + end + + context 'with a non standard lens_dir' do + let (:params) do + { + :lens_dir => '/opt/augeas/lenses', + } + end + + it { is_expected.to contain_file('/opt/augeas/lenses').with( + :ensure => 'directory', + :purge => 'true', + :force => 'true', + :recurse => 'true', + :recurselimit => 1 + ) } + it { is_expected.to contain_file('/opt/augeas/lenses/dist').with( + :ensure => 'directory', + :purge => 'false' + ) } + it { is_expected.to contain_file('/opt/augeas/lenses/tests').with( + :ensure => 'directory', + :purge => 'true', + :force => 'true' + ).without(:recurse) } + end + end + end +end |