|
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
|
|
15 | 14 | it { is_expected.to run.with_params('2foo.example.com', '2foo.example.com.') }
|
16 | 15 | it { is_expected.to run.with_params('www.2foo.example.com', 'www.2foo.example.com.') }
|
17 | 16 | it { is_expected.to run.with_params('domain.tld', 'puppet.com') }
|
| 17 | + it { is_expected.to run.with_params('www.example.2com') } |
| 18 | + it { is_expected.to run.with_params('10.10.10.10.10') } |
18 | 19 | end
|
19 | 20 |
|
20 | 21 | 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}) } |
| 22 | + it { is_expected.to run.with_params([]).and_raise_error(ArgumentError, %r{got Array}) } |
| 23 | + it { is_expected.to run.with_params({}).and_raise_error(ArgumentError, %r{got Hash}) } |
| 24 | + it { is_expected.to run.with_params(1).and_raise_error(ArgumentError, %r{got Integer}) } |
| 25 | + it { is_expected.to run.with_params(true).and_raise_error(ArgumentError, %r{got Boolean}) } |
25 | 26 |
|
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}) } |
| 27 | + it { is_expected.to run.with_params('foo.example.com', []).and_raise_error(ArgumentError, %r{got Array}) } |
| 28 | + it { is_expected.to run.with_params('foo.example.com', {}).and_raise_error(ArgumentError, %r{got Hash}) } |
| 29 | + it { is_expected.to run.with_params('foo.example.com', 1).and_raise_error(ArgumentError, %r{got Integer}) } |
| 30 | + it { is_expected.to run.with_params('foo.example.com', true).and_raise_error(ArgumentError, %r{got Boolean}) } |
30 | 31 |
|
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}) } |
| 32 | + it { is_expected.to run.with_params('').and_raise_error(ArgumentError, %r{got ''}) } |
| 33 | + it { is_expected.to run.with_params('invalid domain').and_raise_error(ArgumentError, %r{got 'invalid domain'}) } |
| 34 | + it { is_expected.to run.with_params('-foo.example.com').and_raise_error(ArgumentError, %r{got '-foo\.example\.com'}) } |
36 | 35 | end
|
37 | 36 | end
|
0 commit comments