diff options
author | tphoney <tp@puppet.com> | 2017-07-14 10:14:04 +0100 |
---|---|---|
committer | tphoney <tp@puppet.com> | 2017-07-14 10:42:10 +0100 |
commit | 33922a4ec7a8c204a17e0c3017eea21faa220f39 (patch) | |
tree | 069c400254276e50176e5b11140c77f831590879 /spec | |
parent | 01d3004f0a6a1c662aea90edd5b1524139706c61 (diff) |
FM-6239 clean up for puppet 5.tests/deprecation
Diffstat (limited to 'spec')
-rw-r--r-- | spec/aliases/absolutepath_spec.rb | 2 | ||||
-rw-r--r-- | spec/aliases/float_spec.rb | 2 | ||||
-rw-r--r-- | spec/aliases/numeric_spec.rb | 2 | ||||
-rw-r--r-- | spec/aliases/string_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/deep_merge_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/strftime_spec.rb | 4 | ||||
-rwxr-xr-x | spec/functions/unique_spec.rb | 46 |
7 files changed, 31 insertions, 29 deletions
diff --git a/spec/aliases/absolutepath_spec.rb b/spec/aliases/absolutepath_spec.rb index cd442f2..ff23dc0 100644 --- a/spec/aliases/absolutepath_spec.rb +++ b/spec/aliases/absolutepath_spec.rb @@ -40,7 +40,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 ].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for Variant/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for.*Variant/) } end end end diff --git a/spec/aliases/float_spec.rb b/spec/aliases/float_spec.rb index 66079c6..84e1934 100644 --- a/spec/aliases/float_spec.rb +++ b/spec/aliases/float_spec.rb @@ -20,7 +20,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3, '3', -3, '-3'].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Float or Pattern(\[.*\]+)?/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects.*Float.*Pattern/) } end end end diff --git a/spec/aliases/numeric_spec.rb b/spec/aliases/numeric_spec.rb index bc17f4f..09c28ec 100644 --- a/spec/aliases/numeric_spec.rb +++ b/spec/aliases/numeric_spec.rb @@ -24,7 +24,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x' ].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Numeric, Pattern(\[.*\]+)?, or Array/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects.*Numeric.*Pattern.*Array/) } end end end diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb index 3ea1967..4fc8ce6 100644 --- a/spec/aliases/string_spec.rb +++ b/spec/aliases/string_spec.rb @@ -24,7 +24,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 ].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?String/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?.*String/) } end end end diff --git a/spec/functions/deep_merge_spec.rb b/spec/functions/deep_merge_spec.rb index c91a07e..819e025 100755 --- a/spec/functions/deep_merge_spec.rb +++ b/spec/functions/deep_merge_spec.rb @@ -4,7 +4,7 @@ describe 'deep_merge' do it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { is_expected.to run.with_params({ 'key' => 'value' }).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { is_expected.to run.with_params({}, '2').and_raise_error(Puppet::ParseError, /unexpected argument type String/) } - it { is_expected.to run.with_params({}, 2).and_raise_error(Puppet::ParseError, /unexpected argument type Fixnum/) } + it { is_expected.to run.with_params({}, 2).and_raise_error(Puppet::ParseError, /unexpected argument/) } it { is_expected.to run.with_params({}, '').and_return({}) } it { is_expected.to run.with_params({}, {}).and_return({}) } it { is_expected.to run.with_params({}, {}, {}).and_return({}) } diff --git a/spec/functions/strftime_spec.rb b/spec/functions/strftime_spec.rb index e76774a..41cda6a 100755 --- a/spec/functions/strftime_spec.rb +++ b/spec/functions/strftime_spec.rb @@ -14,9 +14,9 @@ describe 'strftime' do expect(result.to_i).to(be > 1311953157) end - it "using %s should be lower then 1.5 trillion" do + it "using %s should be greater than 1.5 trillion" do result = scope.function_strftime(["%s"]) - expect(result.to_i).to(be < 1500000000) + expect(result.to_i).to(be > 1500000000) end it "should return a date when given %Y-%m-%d" do diff --git a/spec/functions/unique_spec.rb b/spec/functions/unique_spec.rb index 7955acb..76932ec 100755 --- a/spec/functions/unique_spec.rb +++ b/spec/functions/unique_spec.rb @@ -1,29 +1,31 @@ require 'spec_helper' describe 'unique' do - 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) } - it { - pending("Current implementation ignores parameters after the first.") - is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) - } - it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } - it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } - it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } - end + if Puppet.version.to_f < 5.0 + 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) } + it { + pending("Current implementation ignores parameters after the first.") + is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) + } + it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } + it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } + it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) } + end - context 'when called with an array' do - it { is_expected.to run.with_params([]).and_return([]) } - it { is_expected.to run.with_params(['a']).and_return(['a']) } - it { is_expected.to run.with_params(['a', 'b', 'a']).and_return(['a', 'b']) } - it { is_expected.to run.with_params(['ã', 'ъ', 'ã']).and_return(['ã', 'ъ']) } - end + context 'when called with an array' do + it { is_expected.to run.with_params([]).and_return([]) } + it { is_expected.to run.with_params(['a']).and_return(['a']) } + it { is_expected.to run.with_params(['a', 'b', 'a']).and_return(['a', 'b']) } + it { is_expected.to run.with_params(['ã', 'ъ', 'ã']).and_return(['ã', 'ъ']) } + end - context 'when called with a string' do - it { is_expected.to run.with_params('').and_return('') } - it { is_expected.to run.with_params('a').and_return('a') } - it { is_expected.to run.with_params('aaba').and_return('ab') } - it { is_expected.to run.with_params('ããъã').and_return('ãъ') } + context 'when called with a string' do + it { is_expected.to run.with_params('').and_return('') } + it { is_expected.to run.with_params('a').and_return('a') } + it { is_expected.to run.with_params('aaba').and_return('ab') } + it { is_expected.to run.with_params('ããъã').and_return('ãъ') } + end end end |