]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Improve tests pdksync
authorDavid Schmitt <david.schmitt@puppet.com>
Mon, 4 Jan 2021 11:51:43 +0000 (11:51 +0000)
committerDavid Schmitt <david.schmitt@puppet.com>
Mon, 4 Jan 2021 14:01:33 +0000 (14:01 +0000)
spec/unit/puppet/type/firewall_spec.rb
spec/unit/puppet/util/ipcidr_spec.rb

index 5bd7895331de02057ff33af0f606fae7453fef09..d034b384aa69da0f94f1020dff05377bf3c7bec5 100755 (executable)
@@ -140,7 +140,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes
 
   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
@@ -148,7 +148,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes
 
   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
@@ -156,7 +156,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes
 
   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
@@ -164,7 +164,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes
 
   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
index 8551928c5b75e6bdc8a16fc4398443deb94f85c2..b57fa354a4a8a9d648daeb2cd717f4f00335adf6 100644 (file)
@@ -56,6 +56,12 @@ describe 'Puppet::Util::IPCidr' do
     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 }