1 | require 'spec_helper'
|
---|
2 |
|
---|
3 | describe 'validate_array' do
|
---|
4 |
|
---|
5 | describe 'signature validation' do
|
---|
6 | after(:all) do
|
---|
7 | ENV.delete('STDLIB_LOG_DEPRECATIONS')
|
---|
8 | end
|
---|
9 | it { is_expected.not_to eq(nil) }
|
---|
10 | # Checking for deprecation warning
|
---|
11 | it 'should display a single deprecation' do
|
---|
12 | ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
|
---|
13 | scope.expects(:warning).with(includes('This method is deprecated'))
|
---|
14 | is_expected.to run.with_params([])
|
---|
15 | end
|
---|
16 | it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
|
---|
17 |
|
---|
18 | describe 'valid inputs' do
|
---|
19 | it { is_expected.to run.with_params([]) }
|
---|
20 | it { is_expected.to run.with_params(['one']) }
|
---|
21 | it { is_expected.to run.with_params([], ['two']) }
|
---|
22 | it { is_expected.to run.with_params(['one'], ['two']) }
|
---|
23 | end
|
---|
24 |
|
---|
25 | describe 'invalid inputs' do
|
---|
26 | it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
27 | it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
28 | it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
29 | it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
30 | it { is_expected.to run.with_params([], {}).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
31 | it { is_expected.to run.with_params([], 1).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
32 | it { is_expected.to run.with_params([], true).and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
33 | it { is_expected.to run.with_params([], 'one').and_raise_error(Puppet::ParseError, /is not an Array/) }
|
---|
34 | end
|
---|
35 | end
|
---|
36 | end
|
---|
37 |
|
---|