diff options
Diffstat (limited to 'spec/functions')
-rwxr-xr-x | spec/functions/is_array_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/is_bool_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/is_string_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/validate_absolute_path_spec.rb | 7 | ||||
-rwxr-xr-x | spec/functions/validate_array_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/validate_bool_spec.rb | 7 | ||||
-rwxr-xr-x | spec/functions/validate_re_spec.rb | 6 | ||||
-rwxr-xr-x | spec/functions/validate_string_spec.rb | 6 |
8 files changed, 46 insertions, 0 deletions
diff --git a/spec/functions/is_array_spec.rb b/spec/functions/is_array_spec.rb index 7dd21c2..e35ca44 100755 --- a/spec/functions/is_array_spec.rb +++ b/spec/functions/is_array_spec.rb @@ -2,6 +2,11 @@ require 'spec_helper' 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')) + is_expected.to run.with_params([]) + end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { pending("Current implementation ignores parameters after the first.") diff --git a/spec/functions/is_bool_spec.rb b/spec/functions/is_bool_spec.rb index 76d619b..9569856 100755 --- a/spec/functions/is_bool_spec.rb +++ b/spec/functions/is_bool_spec.rb @@ -2,6 +2,11 @@ require 'spec_helper' 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')) + 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) } it { is_expected.to run.with_params(true, false).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { is_expected.to run.with_params(true).and_return(true) } diff --git a/spec/functions/is_string_spec.rb b/spec/functions/is_string_spec.rb index 8e459cc..8056ed4 100755 --- a/spec/functions/is_string_spec.rb +++ b/spec/functions/is_string_spec.rb @@ -2,6 +2,11 @@ require 'spec_helper' 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')) + 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) } it { pending("Current implementation ignores parameters after the first.") diff --git a/spec/functions/validate_absolute_path_spec.rb b/spec/functions/validate_absolute_path_spec.rb index 4a8404d..ffdb2c8 100755 --- a/spec/functions/validate_absolute_path_spec.rb +++ b/spec/functions/validate_absolute_path_spec.rb @@ -1,6 +1,13 @@ require 'spec_helper' 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 + is_expected.to run.with_params('c:/') + end + describe 'signature validation' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/validate_array_spec.rb b/spec/functions/validate_array_spec.rb index 4ee7754..0ba7108 100755 --- a/spec/functions/validate_array_spec.rb +++ b/spec/functions/validate_array_spec.rb @@ -3,6 +3,11 @@ require 'spec_helper' describe 'validate_array' do describe 'signature validation' 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')) + is_expected.to run.with_params([]) + end it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } describe 'valid inputs' do diff --git a/spec/functions/validate_bool_spec.rb b/spec/functions/validate_bool_spec.rb index d9cdf57..b0f41a8 100755 --- a/spec/functions/validate_bool_spec.rb +++ b/spec/functions/validate_bool_spec.rb @@ -1,6 +1,13 @@ require 'spec_helper' 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 + is_expected.to run.with_params(true) + end + describe 'signature validation' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/validate_re_spec.rb b/spec/functions/validate_re_spec.rb index 3f90143..f6fa931 100755 --- a/spec/functions/validate_re_spec.rb +++ b/spec/functions/validate_re_spec.rb @@ -1,6 +1,12 @@ 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')) + is_expected.to run.with_params('', '') + end + describe 'signature validation' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } diff --git a/spec/functions/validate_string_spec.rb b/spec/functions/validate_string_spec.rb index f0c500e..9bfef66 100755 --- a/spec/functions/validate_string_spec.rb +++ b/spec/functions/validate_string_spec.rb @@ -1,6 +1,12 @@ 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')) + is_expected.to run.with_params('', '') + end + describe 'signature validation' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } |