diff options
author | David Schmitt <david.schmitt@puppet.com> | 2016-07-18 13:27:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-18 13:27:49 +0100 |
commit | 01bc41e73621fa07d0b14b3b3fa8a75e666a7df5 (patch) | |
tree | 82a2087cd945247dfadee41dcd8f8cd5bec84ab6 /spec/acceptance | |
parent | 9224143da2195c57ce814e837f722348c2038ecb (diff) | |
parent | 72d23659513517389880ba13663a1d6380d538ca (diff) |
Merge pull request #617 from tphoney/add_deprecate_function
(MODULES-3529) add deprecation function
Diffstat (limited to 'spec/acceptance')
-rw-r--r-- | spec/acceptance/deprecation_spec.rb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/spec/acceptance/deprecation_spec.rb b/spec/acceptance/deprecation_spec.rb new file mode 100644 index 0000000..d0d7fed --- /dev/null +++ b/spec/acceptance/deprecation_spec.rb @@ -0,0 +1,75 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' +require 'shellwords' + +describe 'deprecation function' do + before :each do + FileUtils.rm_rf '/tmp/deprecation' + end + + context 'with --strict=error', if: get_puppet_version =~ /^4/ do + before :all do + pp = <<-EOS + deprecation('key', 'message') + file { '/tmp/deprecation': ensure => present } + EOS + @result = on(default, puppet('apply', '--strict=error', '-e', Shellwords.shellescape(pp)), acceptable_exit_codes: (0...256)) + end + + it "should return an error" do + expect(@result.exit_code).to eq(1) + end + + it "should show the error message" do + expect(@result.stderr).to match(/deprecation. key. message/) + end + + describe file('/tmp/deprecation') do + it { is_expected.not_to exist } + end + end + + context 'with --strict=warning', if: get_puppet_version =~ /^4/ do + before :all do + pp = <<-EOS + deprecation('key', 'message') + file { '/tmp/deprecation': ensure => present } + EOS + @result = on(default, puppet('apply', '--strict=warning', '-e', Shellwords.shellescape(pp)), acceptable_exit_codes: (0...256)) + end + + it "should not return an error" do + expect(@result.exit_code).to eq(0) + end + + it "should show the error message" do + expect(@result.stderr).to match(/Warning: message/) + end + + describe file('/tmp/deprecation') do + it { is_expected.to exist } + end + end + + context 'with --strict=off', if: get_puppet_version =~ /^4/ do + before :all do + pp = <<-EOS + deprecation('key', 'message') + file { '/tmp/deprecation': ensure => present } + EOS + @result = on(default, puppet('apply', '--strict=off', '-e', Shellwords.shellescape(pp)), acceptable_exit_codes: (0...256)) + end + + it "should not return an error" do + expect(@result.exit_code).to eq(0) + end + + it "should not show the error message" do + expect(@result.stderr).not_to match(/Warning: message/) + end + + describe file('/tmp/deprecation') do + it { is_expected.to exist } + end + end +end |