describe 'source error checking' do
it 'Invalid address when 256.168.2.0/24' do
- expect(-> { resource[:source] = '256.168.2.0/24' }).to raise_error(
+ expect { resource[:source] = '256.168.2.0/24' }.to raise_error(
Puppet::Error, %r{host_to_ip failed}
)
end
describe 'destination error checking' do
it 'Invalid address when 256.168.2.0/24' do
- expect(-> { resource[:destination] = '256.168.2.0/24' }).to raise_error(
+ expect { resource[:destination] = '256.168.2.0/24' }.to raise_error(
Puppet::Error, %r{host_to_ip failed}
)
end
describe 'src_range error checking' do
it 'Invalid IP when 392.168.1.1-192.168.1.10' do
- expect(-> { resource[:src_range] = '392.168.1.1-192.168.1.10' }).to raise_error(
+ expect { resource[:src_range] = '392.168.1.1-192.168.1.10' }.to raise_error(
Puppet::Error, %r{Invalid IP address}
)
end
describe 'dst_range error checking' do
it 'Invalid IP when 392.168.1.1-192.168.1.10' do
- expect(-> { resource[:dst_range] = '392.168.1.1-192.168.1.10' }).to raise_error(
+ expect { resource[:dst_range] = '392.168.1.1-192.168.1.10' }.to raise_error(
Puppet::Error, %r{Invalid IP address}
)
end
it { expect(host.netmask).to eql '0.0.0.0' }
end
+ describe 'ipv4 invalid address' do
+ subject(:host) { Puppet::Util::IPCidr.new('256.168.2.0/24') }
+
+ it { expect { host }.to raise_error ArgumentError, %r{256.168.2.0/24} }
+ end
+
describe 'ipv6 address' do
subject(:host) { ipaddr }