diff options
Diffstat (limited to 'spec/functions')
-rw-r--r-- | spec/functions/deprecation_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/join_keys_to_values_spec.rb | 4 | ||||
-rw-r--r-- | spec/functions/validate_legacy_spec.rb | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/spec/functions/deprecation_spec.rb b/spec/functions/deprecation_spec.rb index 9859833..cee4f1c 100644 --- a/spec/functions/deprecation_spec.rb +++ b/spec/functions/deprecation_spec.rb @@ -41,11 +41,14 @@ if Puppet.version.to_f >= 4.0 } end else + # Puppet version < 4 will use these tests. describe 'deprecation' do after(:all) do ENV.delete('STDLIB_LOG_DEPRECATIONS') end - ENV['STDLIB_LOG_DEPRECATIONS'] = "true" + before(:all) do + ENV['STDLIB_LOG_DEPRECATIONS'] = "true" + end 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/join_keys_to_values_spec.rb b/spec/functions/join_keys_to_values_spec.rb index 6c109d1..c2bae5b 100755 --- a/spec/functions/join_keys_to_values_spec.rb +++ b/spec/functions/join_keys_to_values_spec.rb @@ -16,4 +16,8 @@ describe 'join_keys_to_values' do result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2' }, ':']) expect(result.sort).to eq(['key1:value1', 'key2:value2'].sort) end + it 'should run join_keys_to_values(<hash with array value>, " ") and return the proper array' do + result = subject.call([{ 'key1' => 'value1', 'key2' => ['value2', 'value3'] }, ' ']) + expect(result.sort).to eq(['key1 value1', 'key2 value2', 'key2 value3'].sort) + end end diff --git a/spec/functions/validate_legacy_spec.rb b/spec/functions/validate_legacy_spec.rb index 45089ef..50cb317 100644 --- a/spec/functions/validate_legacy_spec.rb +++ b/spec/functions/validate_legacy_spec.rb @@ -28,7 +28,7 @@ if Puppet.version.to_f >= 4.0 describe 'when failing the type assertion and passing the previous validation' do before do scope.expects(:function_validate_foo).with(['5']).once - subject.func.expects(:call_function).with('deprecation', 'validate_legacy', includes('expected an Integer value')).once + subject.func.expects(:call_function).with('deprecation', 'validate_legacy', includes('Integer')).once end it 'passes with a deprecation message' do is_expected.to run.with_params('Integer', 'validate_foo', '5') @@ -38,7 +38,7 @@ if Puppet.version.to_f >= 4.0 describe 'when failing the type assertion and failing the previous validation' do before do scope.expects(:function_validate_foo).with(['5']).raises(Puppet::ParseError, 'foo').once - subject.func.expects(:call_function).with('fail', includes('expected an Integer value')).once + subject.func.expects(:call_function).with('fail', includes('Integer')).once end it 'fails with a helpful message' do is_expected.to run.with_params('Integer', 'validate_foo', '5') |