summaryrefslogtreecommitdiff
path: root/spec/functions/is_ip_address_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functions/is_ip_address_spec.rb')
-rwxr-xr-xspec/functions/is_ip_address_spec.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/functions/is_ip_address_spec.rb b/spec/functions/is_ip_address_spec.rb
index 9386ca9..fc8af60 100755
--- a/spec/functions/is_ip_address_spec.rb
+++ b/spec/functions/is_ip_address_spec.rb
@@ -20,9 +20,21 @@ describe 'is_ip_address' do
it { is_expected.to run.with_params(1).and_return(false) }
it { is_expected.to run.with_params({}).and_return(false) }
it { is_expected.to run.with_params([]).and_return(false) }
- # Checking for deprecation warning
- it 'should display a single deprecation' do
- scope.expects(:warning).with(includes('This method is deprecated'))
- is_expected.to run.with_params('1.1.1.1')
+
+ context 'Checking for deprecation warning', if: Puppet.version.to_f < 4.0 do
+ # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
+ it 'should display a single deprecation' do
+ ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
+ scope.expects(:warning).with(includes('This method is deprecated'))
+ is_expected.to run.with_params('1.2.3.4').and_return(true)
+ end
+ it 'should display no warning for deprecation' do
+ ENV['STDLIB_LOG_DEPRECATIONS'] = "false"
+ scope.expects(:warning).with(includes('This method is deprecated')).never
+ is_expected.to run.with_params('1.2.3.4').and_return(true)
+ end
+ after(:context) do
+ ENV.delete('STDLIB_LOG_DEPRECATIONS')
+ end
end
end