diff options
-rw-r--r-- | lib/puppet/parser/functions/deprecation.rb | 2 | ||||
-rw-r--r-- | spec/functions/deprecation_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/ensure_resource_spec.rb | 7 | ||||
-rwxr-xr-x | spec/functions/is_array_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_bool_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_float_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_integer_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_numeric_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_string_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_absolute_path_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_array_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_bool_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_integer_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_numeric_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_re_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/validate_string_spec.rb | 2 |
16 files changed, 21 insertions, 16 deletions
diff --git a/lib/puppet/parser/functions/deprecation.rb b/lib/puppet/parser/functions/deprecation.rb index 5d74984..fc861a6 100644 --- a/lib/puppet/parser/functions/deprecation.rb +++ b/lib/puppet/parser/functions/deprecation.rb @@ -10,6 +10,6 @@ EOS key = arguments[0] message = arguments[1] - warn("deprecation. #{key}. #{message}") + warning("deprecation. #{key}. #{message}") end end diff --git a/spec/functions/deprecation_spec.rb b/spec/functions/deprecation_spec.rb index a596e24..c213190 100644 --- a/spec/functions/deprecation_spec.rb +++ b/spec/functions/deprecation_spec.rb @@ -46,7 +46,7 @@ else it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it 'should display a single warning' do - scope.expects(:warn).with(includes('heelo')) + scope.expects(:warning).with(includes('heelo')) is_expected.to run.with_params('key', 'heelo') end end diff --git a/spec/functions/ensure_resource_spec.rb b/spec/functions/ensure_resource_spec.rb index 9a17f5b..d552f4e 100755 --- a/spec/functions/ensure_resource_spec.rb +++ b/spec/functions/ensure_resource_spec.rb @@ -4,7 +4,12 @@ describe 'ensure_resource' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a type/) } it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, /Must specify a title/) } - it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(Puppet::ParseError) } + if Puppet.version.to_f >= 4.6 + it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(ArgumentError) } + else + it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(Puppet::ParseError) } + end + it { pending("should not accept numbers as arguments") is_expected.to run.with_params(1,2,3).and_raise_error(Puppet::ParseError) diff --git a/spec/functions/is_array_spec.rb b/spec/functions/is_array_spec.rb index e35ca44..0a8070b 100755 --- a/spec/functions/is_array_spec.rb +++ b/spec/functions/is_array_spec.rb @@ -4,7 +4,7 @@ describe 'is_array' do it { is_expected.not_to eq(nil) } # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params([]) end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/is_bool_spec.rb b/spec/functions/is_bool_spec.rb index 9569856..4550e61 100755 --- a/spec/functions/is_bool_spec.rb +++ b/spec/functions/is_bool_spec.rb @@ -4,7 +4,7 @@ describe 'is_bool' do it { is_expected.not_to eq(nil) } # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(true) end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/is_float_spec.rb b/spec/functions/is_float_spec.rb index 267d9c6..cb7e148 100755 --- a/spec/functions/is_float_spec.rb +++ b/spec/functions/is_float_spec.rb @@ -5,7 +5,7 @@ describe 'is_float' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(3) end diff --git a/spec/functions/is_integer_spec.rb b/spec/functions/is_integer_spec.rb index 49550c7..2d68731 100755 --- a/spec/functions/is_integer_spec.rb +++ b/spec/functions/is_integer_spec.rb @@ -5,7 +5,7 @@ describe 'is_integer' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(3) end diff --git a/spec/functions/is_numeric_spec.rb b/spec/functions/is_numeric_spec.rb index b7de051..f4ead56 100755 --- a/spec/functions/is_numeric_spec.rb +++ b/spec/functions/is_numeric_spec.rb @@ -5,7 +5,7 @@ describe 'is_numeric' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(3) end diff --git a/spec/functions/is_string_spec.rb b/spec/functions/is_string_spec.rb index 8056ed4..4f59b63 100755 --- a/spec/functions/is_string_spec.rb +++ b/spec/functions/is_string_spec.rb @@ -4,7 +4,7 @@ describe 'is_string' do it { is_expected.not_to eq(nil) } # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params('ha') end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/validate_absolute_path_spec.rb b/spec/functions/validate_absolute_path_spec.rb index ffdb2c8..dbac88f 100755 --- a/spec/functions/validate_absolute_path_spec.rb +++ b/spec/functions/validate_absolute_path_spec.rb @@ -4,7 +4,7 @@ describe 'validate_absolute_path' do # Checking for deprecation warning it 'should display a single deprecation' do # called twice because validate_absolute_path calls is_absolute_path - scope.expects(:warn).with(includes('This method is deprecated')).twice + scope.expects(:warning).with(includes('This method is deprecated')).twice is_expected.to run.with_params('c:/') end diff --git a/spec/functions/validate_array_spec.rb b/spec/functions/validate_array_spec.rb index 0ba7108..9f2e210 100755 --- a/spec/functions/validate_array_spec.rb +++ b/spec/functions/validate_array_spec.rb @@ -5,7 +5,7 @@ describe 'validate_array' do it { is_expected.not_to eq(nil) } # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params([]) end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/validate_bool_spec.rb b/spec/functions/validate_bool_spec.rb index b0f41a8..724e31f 100755 --- a/spec/functions/validate_bool_spec.rb +++ b/spec/functions/validate_bool_spec.rb @@ -4,7 +4,7 @@ describe 'validate_bool' do # Checking for deprecation warning it 'should display a single deprecation' do #called twice, because validate_bool calls is_bool - scope.expects(:warn).with(includes('This method is deprecated')).twice + scope.expects(:warning).with(includes('This method is deprecated')).twice is_expected.to run.with_params(true) end diff --git a/spec/functions/validate_integer_spec.rb b/spec/functions/validate_integer_spec.rb index 0eeab1e..3ca50b2 100755 --- a/spec/functions/validate_integer_spec.rb +++ b/spec/functions/validate_integer_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'validate_integer' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(3) end diff --git a/spec/functions/validate_numeric_spec.rb b/spec/functions/validate_numeric_spec.rb index 2e5561e..2869e5f 100755 --- a/spec/functions/validate_numeric_spec.rb +++ b/spec/functions/validate_numeric_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'validate_numeric' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params(3) end diff --git a/spec/functions/validate_re_spec.rb b/spec/functions/validate_re_spec.rb index f6fa931..4b78a2e 100755 --- a/spec/functions/validate_re_spec.rb +++ b/spec/functions/validate_re_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'validate_re' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params('', '') end diff --git a/spec/functions/validate_string_spec.rb b/spec/functions/validate_string_spec.rb index 9bfef66..ef7a1b4 100755 --- a/spec/functions/validate_string_spec.rb +++ b/spec/functions/validate_string_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'validate_string' do # Checking for deprecation warning it 'should display a single deprecation' do - scope.expects(:warn).with(includes('This method is deprecated')) + scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params('', '') end |