|
5 | 5 | describe 'validate_domain_name' do
|
6 | 6 | describe 'signature validation' do
|
7 | 7 | it { is_expected.not_to eq(nil) }
|
8 |
| - it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } |
9 | 8 | end
|
10 | 9 |
|
11 | 10 | describe 'valid inputs' do
|
|
18 | 17 | end
|
19 | 18 |
|
20 | 19 | describe 'invalid inputs' do
|
21 |
| - it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
22 |
| - it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
23 |
| - it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
24 |
| - it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
| 20 | + it { is_expected.to run.with_params([]).and_raise_error(ArgumentError, %r{got Array}) } |
| 21 | + it { is_expected.to run.with_params({}).and_raise_error(ArgumentError, %r{got Hash}) } |
| 22 | + it { is_expected.to run.with_params(1).and_raise_error(ArgumentError, %r{got Integer}) } |
| 23 | + it { is_expected.to run.with_params(true).and_raise_error(ArgumentError, %r{got Boolean}) } |
25 | 24 |
|
26 |
| - it { is_expected.to run.with_params('foo.example.com', []).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
27 |
| - it { is_expected.to run.with_params('foo.example.com', {}).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
28 |
| - it { is_expected.to run.with_params('foo.example.com', 1).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
29 |
| - it { is_expected.to run.with_params('foo.example.com', true).and_raise_error(Puppet::ParseError, %r{is not a string}) } |
| 25 | + it { is_expected.to run.with_params('foo.example.com', []).and_raise_error(ArgumentError, %r{got Array}) } |
| 26 | + it { is_expected.to run.with_params('foo.example.com', {}).and_raise_error(ArgumentError, %r{got Hash}) } |
| 27 | + it { is_expected.to run.with_params('foo.example.com', 1).and_raise_error(ArgumentError, %r{got Integer}) } |
| 28 | + it { is_expected.to run.with_params('foo.example.com', true).and_raise_error(ArgumentError, %r{got Boolean}) } |
30 | 29 |
|
31 |
| - it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{is not a syntactically correct domain name}) } |
32 |
| - it { is_expected.to run.with_params('invalid domain').and_raise_error(Puppet::ParseError, %r{is not a syntactically correct domain name}) } |
33 |
| - it { is_expected.to run.with_params('-foo.example.com').and_raise_error(Puppet::ParseError, %r{is not a syntactically correct domain name}) } |
34 |
| - it { is_expected.to run.with_params('www.example.2com').and_raise_error(Puppet::ParseError, %r{is not a syntactically correct domain name}) } |
35 |
| - it { is_expected.to run.with_params('192.168.1.1').and_raise_error(Puppet::ParseError, %r{is not a syntactically correct domain name}) } |
| 30 | + it { is_expected.to run.with_params('').and_raise_error(ArgumentError, %r{got ''}) } |
| 31 | + it { is_expected.to run.with_params('invalid domain').and_raise_error(ArgumentError, %r{got 'invalid domain'}) } |
| 32 | + it { is_expected.to run.with_params('-foo.example.com').and_raise_error(ArgumentError, %r{got '-foo\.example\.com'}) } |
| 33 | + it { is_expected.to run.with_params('www.example.2com').and_raise_error(ArgumentError, %r{got 'www\.example\.2com'}) } |
| 34 | + it { is_expected.to run.with_params('192.168.1.1').and_raise_error(ArgumentError, %r{got '192\.168\.1\.1'}) } |
36 | 35 | end
|
37 | 36 | end
|
0 commit comments