diff options
author | Mickaël Canévet <mickael.canevet@camptocamp.com> | 2015-08-12 15:07:35 +0200 |
---|---|---|
committer | Mickaël Canévet <mickael.canevet@camptocamp.com> | 2015-08-12 15:07:35 +0200 |
commit | ea07077f8427fc9807b9de8503f2f73dc0f7d1f8 (patch) | |
tree | 0de3ee34aa802f0135c2d2bbe38e96dc6d8d6af3 /spec/defines/augeas_lens_spec.rb | |
parent | 2afa04fa07399f66917aa24ee6ca959ea38cc0ac (diff) | |
parent | 3e23d677370d44b62495022338b8cc12f42bd30f (diff) |
Merge pull request #54 from mcanevet/puppet4
Puppet4
Diffstat (limited to 'spec/defines/augeas_lens_spec.rb')
-rw-r--r-- | spec/defines/augeas_lens_spec.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/spec/defines/augeas_lens_spec.rb b/spec/defines/augeas_lens_spec.rb index 21dfd55..f4e5be7 100644 --- a/spec/defines/augeas_lens_spec.rb +++ b/spec/defines/augeas_lens_spec.rb @@ -11,12 +11,12 @@ describe 'augeas::lens' do end it 'should error' do - expect { - is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') - }.to raise_error(Puppet::Error, /You must declare the augeas class/) + expect { is_expected.to compile }.to raise_error(/You must declare the augeas class/) end end + lens_dir = Puppet.version < '4.0.0' ? '/usr/share/augeas/lenses' : '/opt/puppetlabs/puppet/share/augeas/lenses' + context 'when declaring augeas class first' do on_supported_os.each do |os, facts| @@ -24,6 +24,7 @@ describe 'augeas::lens' do let(:facts) do facts.merge({ :augeasversion => :undef, + :puppetversion => Puppet.version, }) end @@ -35,9 +36,7 @@ describe 'augeas::lens' do context 'when no lens_source is passed' do it 'should error' do - expect { - is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') - }.to raise_error(Puppet::Error, /You must set either \$lens_source or \$lens_content/) + expect { is_expected.to compile }.to raise_error(/You must set either \$lens_source or \$lens_content/) end end @@ -48,9 +47,9 @@ describe 'augeas::lens' do } end - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } + it { is_expected.to contain_file("#{lens_dir}/foo.aug") } it { is_expected.to contain_exec('Typecheck lens foo') } - it { is_expected.not_to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } + it { is_expected.not_to contain_file("#{lens_dir}/tests/test_foo.aug") } it { is_expected.not_to contain_exec('Test lens foo') } end @@ -62,9 +61,9 @@ describe 'augeas::lens' do } end - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } + it { is_expected.to contain_file("#{lens_dir}/foo.aug") } + it { is_expected.to contain_file("#{lens_dir}/tests/test_foo.aug") } it { is_expected.to contain_exec('Typecheck lens foo') } - it { is_expected.to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } it { is_expected.to contain_exec('Test lens foo') } end end @@ -81,7 +80,7 @@ describe 'augeas::lens' do "class { '::augeas': version => '1.0.0' }" end - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } + it { is_expected.to contain_file("#{lens_dir}/foo.aug") } it { is_expected.to contain_exec('Typecheck lens foo') } end @@ -99,7 +98,7 @@ describe 'augeas::lens' do it do pending "undefined method `negative_failure_message'" - is_expected.not_to contain_file('/usr/share/augeas/lenses/foo.aug') + is_expected.not_to contain_file("#{lens_dir}/foo.aug") end it do pending "undefined method `negative_failure_message'" |