3 describe 'stdlib::ip_in_range' do
4 describe 'signature validation' do
5 it { is_expected.not_to eq(nil) }
6 it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{'stdlib::ip_in_range' expects 2 arguments, got none}) }
7 it { is_expected.to run.with_params('one', 'two', '3').and_raise_error(ArgumentError, %r{'stdlib::ip_in_range' expects 2 arguments, got 3}) }
8 it { is_expected.to run.with_params([], []).and_raise_error(ArgumentError, %r{'stdlib::ip_in_range' parameter 'ipaddress' expects a String value, got Array}) }
9 it { is_expected.to run.with_params('1.1.1.1', 7).and_raise_error(ArgumentError, %r{'stdlib::ip_in_range' parameter 'range' expects a value of type String or Array, got Integer}) }
12 describe 'basic validation inputs' do
13 it { is_expected.to run.with_params('192.168.100.12', '192.168.100.0/24').and_return(true) }
14 it { is_expected.to run.with_params('192.168.100.12', ['10.10.10.10/24', '192.168.100.0/24']).and_return(true) }
15 it { is_expected.to run.with_params('10.10.10.10', '192.168.100.0/24').and_return(false) }