]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix up all rspec deprecation warnings.
authorAlex Harvey <Alex.Harvey@team.telstra.com>
Wed, 30 Mar 2016 03:34:35 +0000 (14:34 +1100)
committerAlex Harvey <Alex.Harvey@team.telstra.com>
Wed, 30 Mar 2016 16:23:53 +0000 (03:23 +1100)
spec/unit/facter/iptables_persistent_version_spec.rb
spec/unit/facter/iptables_spec.rb
spec/unit/puppet/provider/iptables_spec.rb
spec/unit/puppet/type/firewall_spec.rb
spec/unit/puppet/type/firewallchain_spec.rb
spec/unit/puppet/util/firewall_spec.rb
spec/unit/puppet/util/ipcidr_spec.rb

index 2c97c3d009c1531262f93fe927ff8fad8d7a4693..656e9049e344fbebdd8e86b28da765e4463aeb58 100644 (file)
@@ -26,7 +26,7 @@ describe "Facter::Util::Fact iptables_persistent_version" do
           allow(Facter::Util::Resolution).to receive(:exec).with(dpkg_cmd).
             and_return(ver)
         }
-        it { Facter.fact(:iptables_persistent_version).value.should == ver }
+        it { expect(Facter.fact(:iptables_persistent_version).value).to eql ver }
       end
     end
 
@@ -37,13 +37,13 @@ describe "Facter::Util::Fact iptables_persistent_version" do
         allow(Facter::Util::Resolution).to receive(:exec).with(dpkg_cmd).
           and_return(nil)
       }
-      it { Facter.fact(:iptables_persistent_version).value.should be_nil }
+      it { expect(Facter.fact(:iptables_persistent_version).value).to be_nil }
     end
 
     describe 'CentOS not supported' do
       before { allow(Facter.fact(:operatingsystem)).to receive(:value).
                  and_return("CentOS") }
-      it { Facter.fact(:iptables_persistent_version).value.should be_nil }
+      it { expect(Facter.fact(:iptables_persistent_version).value).to be_nil }
     end
 
   end
@@ -71,7 +71,7 @@ describe "Facter::Util::Fact iptables_persistent_version" do
           allow(Facter::Util::Resolution).to receive(:exec).with(dpkg_cmd).
             and_return(ver)
         }
-        it { Facter.fact(:iptables_persistent_version).value.should == ver }
+        it { expect(Facter.fact(:iptables_persistent_version).value).to eql ver }
       end
     end
 
@@ -83,18 +83,15 @@ describe "Facter::Util::Fact iptables_persistent_version" do
         allow(Facter::Util::Resolution).to receive(:exec).with(dpkg_cmd).
           and_return(nil)
       }
-      it { Facter.fact(:iptables_persistent_version).value.should be_nil }
+      it { expect(Facter.fact(:iptables_persistent_version).value).to be_nil }
     end
 
     describe 'CentOS not supported' do
       before { allow(Facter.fact(:operatingsystem)).to receive(:value).
                  and_return("CentOS") }
-      it { Facter.fact(:iptables_persistent_version).value.should be_nil }
+      it { expect(Facter.fact(:iptables_persistent_version).value).to be_nil }
     end
 
   end
 
-
-
-
 end
index 5773fdce569c6cc94dcd7386fe66b666a536b63f..c17816c7451682fe15493a584defa6f402eba77f 100644 (file)
@@ -11,13 +11,13 @@ describe "Facter::Util::Fact" do
     it {
       allow(Facter::Util::Resolution).to receive(:exec).with('iptables --version').
       and_return('iptables v1.4.7')
-      Facter.fact(:iptables_version).value.should == '1.4.7'
+      expect(Facter.fact(:iptables_version).value).to eql '1.4.7'
     }
   end
 
   describe 'ip6tables_version' do
     before { allow(Facter::Util::Resolution).to receive(:exec).
              with('ip6tables --version').and_return('ip6tables v1.4.7') }
-    it { Facter.fact(:ip6tables_version).value.should == '1.4.7' }
+    it { expect(Facter.fact(:ip6tables_version).value).to eql '1.4.7' }
   end
 end
index 0fe61199e961ed278a0c65224ce039fd5ed43147..f9316d96abec22b834fcb2de1cc72ec90a5ec7da 100644 (file)
@@ -27,14 +27,14 @@ describe 'iptables provider detection' do
     allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Debian')
   end
 
-  it "should default to iptables provider if /sbin/iptables[-save] exists" do
+  it "is expected to default to iptables provider if /sbin/iptables[-save] exists" do
     # Stub lookup for /sbin/iptables & /sbin/iptables-save
     allow(exists).to receive(:which).with("iptables").
       and_return "/sbin/iptables"
     allow(exists).to receive(:which).with("iptables-save").
       and_return "/sbin/iptables-save"
 
-    # Every other command should return false so we don't pick up any
+    # Every other command is expected to return false so we don't pick up any
     # other providers
     allow(exists).to receive(:which) { |value|
       ! ["iptables","iptables-save"].include?(value)
@@ -69,14 +69,14 @@ describe 'iptables provider' do
       and_return "/sbin/iptables-save"
   end
 
-  it 'should be able to get a list of existing rules' do
+  it 'is expected to be able to get a list of existing rules' do
     provider.instances.each do |rule|
       expect(rule).to be_instance_of(provider)
       expect(rule.properties[:provider].to_s).to eq(provider.name.to_s)
     end
   end
 
-  it 'should ignore lines with fatal errors' do
+  it 'is expected to ignore lines with fatal errors' do
     allow(Puppet::Util::Execution).to receive(:execute).with(['/sbin/iptables-save']).
       and_return("FATAL: Could not load /lib/modules/2.6.18-028stab095.1/modules.dep: No such file or directory")
 
@@ -379,17 +379,17 @@ describe 'ip6tables provider' do
       and_return "/sbin/ip6tables-save"
   end
 
-  it 'should be able to get a list of existing rules' do
+  it 'is expected to be able to get a list of existing rules' do
     provider6.instances.each do |rule|
-      rule.should be_instance_of(provider6)
-      rule.properties[:provider6].to_s.should == provider6.name.to_s
+      expect(rule).to be_instance_of(provider6)
+      expect(rule.properties[:provider6].to_s).to eql provider6.name.to_s
     end
   end
 
-  it 'should ignore lines with fatal errors' do
+  it 'is expected to ignore lines with fatal errors' do
     allow(Puppet::Util::Execution).to receive(:execute).with(['/sbin/ip6tables-save']).
       and_return("FATAL: Could not load /lib/modules/2.6.18-028stab095.1/modules.dep: No such file or directory")
-    provider6.instances.length.should == 0
+    expect(provider6.instances.length).to eq 0
   end
 
   # Load in ruby hash for test fixtures.
@@ -403,14 +403,14 @@ describe 'ip6tables provider' do
         # If this option is enabled, make sure the parameters exactly match
         if data[:compare_all] then
           it "the parameter hash keys should be the same as returned by rules_to_hash" do
-            resource.keys.should =~ data[:params].keys
+            expect(resource.keys).to match data[:params].keys
           end
         end
 
         # Iterate across each parameter, creating an example for comparison
         data[:params].each do |param_name, param_value|
           it "the parameter '#{param_name.to_s}' should match #{param_value.inspect}" do
-            resource[param_name].should == data[:params][param_name]
+            expect(resource[param_name]).to eql data[:params][param_name]
           end
         end
       end
@@ -425,7 +425,7 @@ describe 'ip6tables provider' do
         let(:instance) { provider6.new(resource) }
 
         it 'general_args should be valid' do
-          instance.general_args.flatten.should == data[:args]
+          expect(instance.general_args.flatten).to eql data[:args]
         end
       end
     end
index c5fdfd8429587e1b2704cca58525aa7b5cdcbb4e..a34963cb82a0bd1a1b5f395d2771c984e639b477 100755 (executable)
@@ -23,35 +23,35 @@ describe firewall do
   end
 
   it 'should have :name be its namevar' do
-    @class.key_attributes.should == [:name]
+    expect(@class.key_attributes).to eql [:name]
   end
 
   describe ':name' do
     it 'should accept a name' do
       @resource[:name] = '000-test-foo'
-      @resource[:name].should == '000-test-foo'
+      expect(@resource[:name]).to eql '000-test-foo'
     end
 
     it 'should not accept a name with non-ASCII chars' do
-      lambda { @resource[:name] = '%*#^(#$' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:name] = '%*#^(#$' }).to raise_error(Puppet::Error)
     end
   end
 
   describe ':action' do
     it "should have no default" do
       res = @class.new(:name => "000 test")
-      res.parameters[:action].should == nil
+      expect(res.parameters[:action]).to eql nil
     end
 
     [:accept, :drop, :reject].each do |action|
       it "should accept value #{action}" do
         @resource[:action] = action
-        @resource[:action].should == action
+        expect(@resource[:action]).to eql action
       end
     end
 
     it 'should fail when value is not recognized' do
-      lambda { @resource[:action] = 'not valid' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:action] = 'not valid' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -59,12 +59,12 @@ describe firewall do
     [:INPUT, :FORWARD, :OUTPUT, :PREROUTING, :POSTROUTING].each do |chain|
       it "should accept chain value #{chain}" do
         @resource[:chain] = chain
-        @resource[:chain].should == chain
+        expect(@resource[:chain]).to eql chain
       end
     end
 
     it 'should fail when the chain value is not recognized' do
-      lambda { @resource[:chain] = 'not valid' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:chain] = 'not valid' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -72,12 +72,12 @@ describe firewall do
     [:nat, :mangle, :filter, :raw].each do |table|
       it "should accept table value #{table}" do
         @resource[:table] = table
-        @resource[:table].should == table
+        expect(@resource[:table]).to eql table
       end
     end
 
     it "should fail when table value is not recognized" do
-      lambda { @resource[:table] = 'not valid' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:table] = 'not valid' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -85,36 +85,36 @@ describe firewall do
     [:ip, :tcp, :udp, :icmp, :esp, :ah, :vrrp, :igmp, :ipencap, :ipv4, :ipv6, :ospf, :gre, :pim, :all].each do |proto|
       it "should accept proto value #{proto}" do
         @resource[:proto] = proto
-        @resource[:proto].should == proto
+        expect(@resource[:proto]).to eql proto
       end
     end
 
     it "should fail when proto value is not recognized" do
-      lambda { @resource[:proto] = 'foo' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:proto] = 'foo' }).to raise_error(Puppet::Error)
     end
   end
 
   describe ':jump' do
     it "should have no default" do
       res = @class.new(:name => "000 test")
-      res.parameters[:jump].should == nil
+      expect(res.parameters[:jump]).to eql nil
     end
 
     ['QUEUE', 'RETURN', 'DNAT', 'SNAT', 'LOG', 'MASQUERADE', 'REDIRECT', 'MARK'].each do |jump|
       it "should accept jump value #{jump}" do
         @resource[:jump] = jump
-        @resource[:jump].should == jump
+        expect(@resource[:jump]).to eql jump
       end
     end
 
     ['ACCEPT', 'DROP', 'REJECT'].each do |jump|
       it "should now fail when value #{jump}" do
-        lambda { @resource[:jump] = jump }.should raise_error(Puppet::Error)
+        expect(lambda { @resource[:jump] = jump }).to raise_error(Puppet::Error)
       end
     end
 
     it "should fail when jump value is not recognized" do
-      lambda { @resource[:jump] = '%^&*' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:jump] = '%^&*' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -122,17 +122,17 @@ describe firewall do
     describe addr do
       it "should accept a #{addr} as a string" do
         @resource[addr] = '127.0.0.1'
-        @resource[addr].should == '127.0.0.1/32'
+        expect(@resource[addr]).to eql '127.0.0.1/32'
       end
       ['0.0.0.0/0', '::/0'].each do |prefix|
         it "should be nil for zero prefix length address #{prefix}" do
           @resource[addr] = prefix
-          @resource[addr].should == nil
+          expect(@resource[addr]).to eql nil
         end
       end
       it "should accept a negated #{addr} as a string" do
         @resource[addr] = '! 127.0.0.1'
-        @resource[addr].should == '! 127.0.0.1/32'
+        expect(@resource[addr]).to eql '! 127.0.0.1/32'
       end
     end
   end
@@ -141,34 +141,34 @@ describe firewall do
     describe port do
       it "should accept a #{port} as string" do
         @resource[port] = '22'
-        @resource[port].should == ['22']
+        expect(@resource[port]).to eql ['22']
       end
 
       it "should accept a #{port} as an array" do
         @resource[port] = ['22','23']
-        @resource[port].should == ['22','23']
+        expect(@resource[port]).to eql ['22','23']
       end
 
       it "should accept a #{port} as a number" do
         @resource[port] = 22
-        @resource[port].should == ['22']
+        expect(@resource[port]).to eql ['22']
       end
 
       it "should accept a #{port} as a hyphen separated range" do
         @resource[port] = ['22-1000']
-        @resource[port].should == ['22-1000']
+        expect(@resource[port]).to eql ['22-1000']
       end
 
       it "should accept a #{port} as a combination of arrays of single and " \
         "hyphen separated ranges" do
 
         @resource[port] = ['22-1000','33','3000-4000']
-        @resource[port].should == ['22-1000','33','3000-4000']
+        expect(@resource[port]).to eql ['22-1000','33','3000-4000']
       end
 
       it "should convert a port name for #{port} to its number" do
         @resource[port] = 'ssh'
-        @resource[port].should == ['22']
+        expect(@resource[port]).to eql ['22']
       end
 
       it "should not accept something invalid for #{port}" do
@@ -192,7 +192,7 @@ describe firewall do
     describe addrtype do
       it "should have no default" do
         res = @class.new(:name => "000 test")
-        res.parameters[addrtype].should == nil
+        expect(res.parameters[addrtype]).to eql nil
       end
     end
 
@@ -200,12 +200,12 @@ describe firewall do
      :UNREACHABLE, :PROHIBIT, :THROW, :NAT, :XRESOLVE].each do |type|
       it "should accept #{addrtype} value #{type}" do
         @resource[addrtype] = type
-        @resource[addrtype].should == type
+        expect(@resource[addrtype]).to eql type
       end
     end
 
     it "should fail when #{addrtype} value is not recognized" do
-      lambda { @resource[addrtype] = 'foo' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[addrtype] = 'foo' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -213,15 +213,15 @@ describe firewall do
     describe iface do
       it "should accept #{iface} value as a string" do
         @resource[iface] = 'eth1'
-        @resource[iface].should == 'eth1'
+        expect(@resource[iface]).to eql 'eth1'
       end
       it "should accept a negated #{iface} value as a string" do
         @resource[iface] = '! eth1'
-        @resource[iface].should == '! eth1'
+        expect(@resource[iface]).to eql '! eth1'
       end
       it "should accept an interface alias for the #{iface} value as a string" do
         @resource[iface] = 'eth1:2'
-        @resource[iface].should == 'eth1:2'
+        expect(@resource[iface]).to eql 'eth1:2'
       end
     end
   end
@@ -251,15 +251,15 @@ describe firewall do
     values.each do |k,v|
       it {
         @resource[:log_level] = k
-        @resource[:log_level].should == v
+        expect(@resource[:log_level]).to eql v
       }
 
       it {
         @resource[:log_level] = 3
-        @resource[:log_level].should == 3
+        expect(@resource[:log_level]).to eql 3
       }
 
-      it { lambda { @resource[:log_level] = 'foo' }.should raise_error(Puppet::Error) }
+      it { expect(lambda { @resource[:log_level] = 'foo' }).to raise_error(Puppet::Error) }
     end
   end
 
@@ -297,9 +297,9 @@ describe firewall do
         values.each do |k,v|
           it 'should convert icmp string to number' do
             @resource[:provider] = provider
-            @resource[:provider].should == provider
+            expect(@resource[:provider]).to eql provider
             @resource[:icmp] = v
-            @resource[:icmp].should == k
+            expect(@resource[:icmp]).to eql k
           end
         end
       end
@@ -307,60 +307,60 @@ describe firewall do
 
     it 'should accept values as integers' do
       @resource[:icmp] = 9
-      @resource[:icmp].should == 9
+      expect(@resource[:icmp]).to eql 9
     end
 
     it 'should fail if icmp type is "any"' do
-      lambda { @resource[:icmp] = 'any' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:icmp] = 'any' }).to raise_error(Puppet::Error)
     end
 
     it 'should fail if icmp type cannot be mapped to a numeric' do
-      lambda { @resource[:icmp] = 'foo' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:icmp] = 'foo' }).to raise_error(Puppet::Error)
     end
   end
 
   describe ':state' do
     it 'should accept value as a string' do
       @resource[:state] = :INVALID
-      @resource[:state].should == [:INVALID]
+      expect(@resource[:state]).to eql [:INVALID]
     end
 
     it 'should accept value as an array' do
       @resource[:state] = [:INVALID, :NEW]
-      @resource[:state].should == [:INVALID, :NEW]
+      expect(@resource[:state]).to eql [:INVALID, :NEW]
     end
 
     it 'should sort values alphabetically' do
       @resource[:state] = [:NEW, :ESTABLISHED]
-      @resource[:state].should == [:ESTABLISHED, :NEW]
+      expect(@resource[:state]).to eql [:ESTABLISHED, :NEW]
     end
   end
 
   describe ':ctstate' do
     it 'should accept value as a string' do
       @resource[:ctstate] = :INVALID
-      @resource[:ctstate].should == [:INVALID]
+      expect(@resource[:ctstate]).to eql [:INVALID]
     end
 
     it 'should accept value as an array' do
       @resource[:ctstate] = [:INVALID, :NEW]
-      @resource[:ctstate].should == [:INVALID, :NEW]
+      expect(@resource[:ctstate]).to eql [:INVALID, :NEW]
     end
 
     it 'should sort values alphabetically' do
       @resource[:ctstate] = [:NEW, :ESTABLISHED]
-      @resource[:ctstate].should == [:ESTABLISHED, :NEW]
+      expect(@resource[:ctstate]).to eql [:ESTABLISHED, :NEW]
     end
   end
 
   describe ':burst' do
     it 'should accept numeric values' do
       @resource[:burst] = 12
-      @resource[:burst].should == 12
+      expect(@resource[:burst]).to eql 12
     end
 
     it 'should fail if value is not numeric' do
-      lambda { @resource[:burst] = 'foo' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:burst] = 'foo' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -368,7 +368,7 @@ describe firewall do
     ['set', 'update', 'rcheck', 'remove'].each do |recent|
       it "should accept recent value #{recent}" do
         @resource[:recent] = recent
-        @resource[:recent].should == "--#{recent}"
+        expect(@resource[:recent]).to eql "--#{recent}"
       end
     end
   end
@@ -387,19 +387,19 @@ describe firewall do
   describe ':gid and :uid' do
     it 'should allow me to set uid' do
       @resource[:uid] = 'root'
-      @resource[:uid].should == 'root'
+      expect(@resource[:uid]).to eql 'root'
     end
     it 'should allow me to set uid as an array, and silently hide my error' do
       @resource[:uid] = ['root', 'bobby']
-      @resource[:uid].should == 'root'
+      expect(@resource[:uid]).to eql 'root'
     end
     it 'should allow me to set gid' do
       @resource[:gid] = 'root'
-      @resource[:gid].should == 'root'
+      expect(@resource[:gid]).to eql 'root'
     end
     it 'should allow me to set gid as an array, and silently hide my error' do
       @resource[:gid] = ['root', 'bobby']
-      @resource[:gid].should == 'root'
+      expect(@resource[:gid]).to eql 'root'
     end
   end
 
@@ -415,14 +415,14 @@ describe firewall do
         if iptables_version == '1.3.2'
           it 'should allow me to set set-mark without mask' do
             @resource[:set_mark] = '0x3e8'
-            @resource[:set_mark].should == '0x3e8'
+            expect(@resource[:set_mark]).to eql '0x3e8'
           end
           it 'should convert int to hex without mask' do
             @resource[:set_mark] = '1000'
-            @resource[:set_mark].should == '0x3e8'
+            expect(@resource[:set_mark]).to eql '0x3e8'
           end
           it 'should fail if mask is present' do
-            lambda { @resource[:set_mark] = '0x3e8/0xffffffff'}.should raise_error(
+            expect(lambda { @resource[:set_mark] = '0x3e8/0xffffffff'}).to raise_error(
               Puppet::Error, /iptables version #{iptables_version} does not support masks on MARK rules$/
             )
           end
@@ -431,31 +431,31 @@ describe firewall do
         if iptables_version == '1.4.2'
           it 'should allow me to set set-mark with mask' do
             @resource[:set_mark] = '0x3e8/0xffffffff'
-            @resource[:set_mark].should == '0x3e8/0xffffffff'
+            expect(@resource[:set_mark]).to eql '0x3e8/0xffffffff'
           end
           it 'should convert int to hex and add a 32 bit mask' do
             @resource[:set_mark] = '1000'
-            @resource[:set_mark].should == '0x3e8/0xffffffff'
+            expect(@resource[:set_mark]).to eql '0x3e8/0xffffffff'
           end
           it 'should add a 32 bit mask' do
             @resource[:set_mark] = '0x32'
-            @resource[:set_mark].should == '0x32/0xffffffff'
+            expect(@resource[:set_mark]).to eql '0x32/0xffffffff'
           end
           it 'should use the mask provided' do
             @resource[:set_mark] = '0x32/0x4'
-            @resource[:set_mark].should == '0x32/0x4'
+            expect(@resource[:set_mark]).to eql '0x32/0x4'
           end
           it 'should use the mask provided and convert int to hex' do
             @resource[:set_mark] = '1000/0x4'
-            @resource[:set_mark].should == '0x3e8/0x4'
+            expect(@resource[:set_mark]).to eql '0x3e8/0x4'
           end
           it 'should fail if mask value is more than 32 bits' do
-            lambda { @resource[:set_mark] = '1/4294967296'}.should raise_error(
+            expect(lambda { @resource[:set_mark] = '1/4294967296'}).to raise_error(
               Puppet::Error, /MARK mask must be integer or hex between 0 and 0xffffffff$/
             )
           end
           it 'should fail if mask is malformed' do
-            lambda { @resource[:set_mark] = '1000/0xq4'}.should raise_error(
+            expect(lambda { @resource[:set_mark] = '1000/0xq4'}).to raise_error(
               Puppet::Error, /MARK mask must be integer or hex between 0 and 0xffffffff$/
             )
           end
@@ -463,11 +463,11 @@ describe firewall do
 
         ['/', '1000/', 'pwnie'].each do |bad_mark|
           it "should fail with malformed mark '#{bad_mark}'" do
-            lambda { @resource[:set_mark] = bad_mark}.should raise_error(Puppet::Error)
+            expect(lambda { @resource[:set_mark] = bad_mark}).to raise_error(Puppet::Error)
           end
         end
         it 'should fail if mark value is more than 32 bits' do
-          lambda { @resource[:set_mark] = '4294967296'}.should raise_error(
+          expect(lambda { @resource[:set_mark] = '4294967296'}).to raise_error(
             Puppet::Error, /MARK value must be integer or hex between 0 and 0xffffffff$/
           )
         end
@@ -479,21 +479,21 @@ describe firewall do
     describe param do
       it 'should autorequire fwchain when table and provider are undefined' do
         @resource[param] = 'FOO'
-        @resource[:table].should == :filter
-        @resource[:provider].should == :iptables
+        expect(@resource[:table]).to eql :filter
+        expect(@resource[:provider]).to eql :iptables
 
         chain = Puppet::Type.type(:firewallchain).new(:name => 'FOO:filter:IPv4')
         catalog = Puppet::Resource::Catalog.new
         catalog.add_resource @resource
         catalog.add_resource chain
         rel = @resource.autorequire[0]
-        rel.source.ref.should == chain.ref
-        rel.target.ref.should == @resource.ref
+        expect(rel.source.ref).to eql chain.ref
+        expect(rel.target.ref).to eql @resource.ref
       end
 
       it 'should autorequire fwchain when table is undefined and provider is ip6tables' do
         @resource[param] = 'FOO'
-        @resource[:table].should == :filter
+        expect(@resource[:table]).to eql :filter
         @resource[:provider] = :ip6tables
 
         chain = Puppet::Type.type(:firewallchain).new(:name => 'FOO:filter:IPv6')
@@ -501,22 +501,22 @@ describe firewall do
         catalog.add_resource @resource
         catalog.add_resource chain
         rel = @resource.autorequire[0]
-        rel.source.ref.should == chain.ref
-        rel.target.ref.should == @resource.ref
+        expect(rel.source.ref).to eql chain.ref
+        expect(rel.target.ref).to eql @resource.ref
       end
 
       it 'should autorequire fwchain when table is raw and provider is undefined' do
         @resource[param] = 'FOO'
         @resource[:table] = :raw
-        @resource[:provider].should == :iptables
+        expect(@resource[:provider]).to eql :iptables
 
         chain = Puppet::Type.type(:firewallchain).new(:name => 'FOO:raw:IPv4')
         catalog = Puppet::Resource::Catalog.new
         catalog.add_resource @resource
         catalog.add_resource chain
         rel = @resource.autorequire[0]
-        rel.source.ref.should == chain.ref
-        rel.target.ref.should == @resource.ref
+        expect(rel.source.ref).to eql chain.ref
+        expect(rel.target.ref).to eql @resource.ref
       end
 
       it 'should autorequire fwchain when table is raw and provider is ip6tables' do
@@ -529,8 +529,8 @@ describe firewall do
         catalog.add_resource @resource
         catalog.add_resource chain
         rel = @resource.autorequire[0]
-        rel.source.ref.should == chain.ref
-        rel.target.ref.should == @resource.ref
+        expect(rel.source.ref).to eql chain.ref
+        expect(rel.target.ref).to eql @resource.ref
       end
 
       # test where autorequire is still needed (table != filter)
@@ -538,15 +538,15 @@ describe firewall do
         it "should autorequire fwchain #{test_chain} when table is mangle and provider is undefined" do
           @resource[param] = test_chain
           @resource[:table] = :mangle
-          @resource[:provider].should == :iptables
+          expect(@resource[:provider]).to eql :iptables
 
           chain = Puppet::Type.type(:firewallchain).new(:name => "#{test_chain}:mangle:IPv4")
           catalog = Puppet::Resource::Catalog.new
           catalog.add_resource @resource
           catalog.add_resource chain
           rel = @resource.autorequire[0]
-          rel.source.ref.should == chain.ref
-          rel.target.ref.should == @resource.ref
+          expect(rel.source.ref).to eql chain.ref
+          expect(rel.target.ref).to eql @resource.ref
         end
 
         it "should autorequire fwchain #{test_chain} when table is mangle and provider is ip6tables" do
@@ -559,8 +559,8 @@ describe firewall do
           catalog.add_resource @resource
           catalog.add_resource chain
           rel = @resource.autorequire[0]
-          rel.source.ref.should == chain.ref
-          rel.target.ref.should == @resource.ref
+          expect(rel.source.ref).to eql chain.ref
+          expect(rel.target.ref).to eql @resource.ref
         end
       end
 
@@ -569,20 +569,20 @@ describe firewall do
 
         it "should not autorequire fwchain #{test_chain} when table and provider are undefined" do
           @resource[param] = test_chain
-          @resource[:table].should == :filter
-          @resource[:provider].should == :iptables
+          expect(@resource[:table]).to eql :filter
+          expect(@resource[:provider]).to eql :iptables
 
           chain = Puppet::Type.type(:firewallchain).new(:name => "#{test_chain}:filter:IPv4")
           catalog = Puppet::Resource::Catalog.new
           catalog.add_resource @resource
           catalog.add_resource chain
           rel = @resource.autorequire[0]
-          rel.should == nil
+          expect(rel).to eql nil
         end
 
         it "should not autorequire fwchain #{test_chain} when table is undefined and provider is ip6tables" do
           @resource[param] = test_chain
-          @resource[:table].should == :filter
+          expect(@resource[:table]).to eql :filter
           @resource[:provider] = :ip6tables
 
           chain = Puppet::Type.type(:firewallchain).new(:name => "#{test_chain}:filter:IPv6")
@@ -590,7 +590,7 @@ describe firewall do
           catalog.add_resource @resource
           catalog.add_resource chain
           rel = @resource.autorequire[0]
-          rel.should == nil
+          expect(rel).to eql nil
         end
       end
     end
@@ -600,8 +600,8 @@ describe firewall do
     it 'should autorequire independent fwchains' do
       @resource[:chain] = 'FOO'
       @resource[:jump] = 'BAR'
-      @resource[:table].should == :filter
-      @resource[:provider].should == :iptables
+      expect(@resource[:table]).to eql :filter
+      expect(@resource[:provider]).to eql :iptables
 
       chain_foo = Puppet::Type.type(:firewallchain).new(:name => 'FOO:filter:IPv4')
       chain_bar = Puppet::Type.type(:firewallchain).new(:name => 'BAR:filter:IPv4')
@@ -610,10 +610,10 @@ describe firewall do
       catalog.add_resource chain_foo
       catalog.add_resource chain_bar
       rel = @resource.autorequire
-      rel[0].source.ref.should == chain_foo.ref
-      rel[0].target.ref.should == @resource.ref
-      rel[1].source.ref.should == chain_bar.ref
-      rel[1].target.ref.should == @resource.ref
+      expect(rel[0].source.ref).to eql chain_foo.ref
+      expect(rel[0].target.ref).to eql @resource.ref
+      expect(rel[1].source.ref).to eql chain_bar.ref
+      expect(rel[1].target.ref).to eql @resource.ref
     end
   end
 
@@ -621,12 +621,12 @@ describe firewall do
     [:multicast, :broadcast, :unicast].each do |pkttype|
       it "should accept pkttype value #{pkttype}" do
         @resource[:pkttype] = pkttype
-        @resource[:pkttype].should == pkttype
+        expect(@resource[:pkttype]).to eql pkttype
       end
     end
 
     it 'should fail when the pkttype value is not recognized' do
-      lambda { @resource[:pkttype] = 'not valid' }.should raise_error(Puppet::Error)
+      expect(lambda { @resource[:pkttype] = 'not valid' }).to raise_error(Puppet::Error)
     end
   end
 
@@ -634,19 +634,19 @@ describe firewall do
     [:iptables, :ip6tables].each do |provider|
       it "provider #{provider} should autorequire package iptables" do
         @resource[:provider] = provider
-        @resource[:provider].should == provider
+        expect(@resource[:provider]).to eql provider
         package = Puppet::Type.type(:package).new(:name => 'iptables')
         catalog = Puppet::Resource::Catalog.new
         catalog.add_resource @resource
         catalog.add_resource package
         rel = @resource.autorequire[0]
-        rel.source.ref.should == package.ref
-        rel.target.ref.should == @resource.ref
+        expect(rel.source.ref).to eql package.ref
+        expect(rel.target.ref).to eql @resource.ref
       end
 
       it "provider #{provider} should autorequire packages iptables, iptables-persistent, and iptables-services" do
         @resource[:provider] = provider
-        @resource[:provider].should == provider
+        expect(@resource[:provider]).to eql provider
         packages = [
           Puppet::Type.type(:package).new(:name => 'iptables'),
           Puppet::Type.type(:package).new(:name => 'iptables-persistent'),
@@ -658,8 +658,8 @@ describe firewall do
           catalog.add_resource package
         end
         packages.zip(@resource.autorequire) do |package, rel|
-          rel.source.ref.should == package.ref
-          rel.target.ref.should == @resource.ref
+          expect(rel.source.ref).to eql package.ref
+          expect(rel.target.ref).to eql @resource.ref
         end
       end
     end
index 3d17f1d37442b8f45073856db3d4f05e34545191..440534e76a16cb353285885fed8389d2eb121389 100755 (executable)
@@ -22,7 +22,7 @@ describe firewallchain do
   }
 
   it 'should have :name be its namevar' do
-    klass.key_attributes.should == [:name]
+    expect(klass.key_attributes).to eql [:name]
   end
 
   describe ':name' do
@@ -40,7 +40,7 @@ describe firewallchain do
             it "should accept #{name} for Linux 3.7+" do
               allow(Facter.fact(:kernelmajversion)).to receive(:value).and_return('3.7')
               resource[:name] = name
-              resource[:name].should == name
+              expect(resource[:name]).to eql name
             end
             it "should fail #{name} for Linux 2.6" do
               allow(Facter.fact(:kernelmajversion)).to receive(:value).and_return('2.6')
@@ -53,7 +53,7 @@ describe firewallchain do
           else
             it "should accept name #{name}" do
               resource[:name] = name
-              resource[:name].should == name
+              expect(resource[:name]).to eql name
             end
           end
         end # chainname
@@ -71,7 +71,7 @@ describe firewallchain do
         if allowedinternalchains.include? internalchain
           it "should allow #{name}" do
             resource[:name] = name
-            resource[:name].should == name
+            expect(resource[:name]).to eql name
           end
         else
           it "should fail #{name}" do
@@ -97,7 +97,7 @@ describe firewallchain do
     [:accept, :drop, :queue, :return].each do |policy|
       it "should accept policy #{policy}" do
         resource[:policy] = policy
-        resource[:policy].should == policy
+        expect(resource[:policy]).to eql policy
       end
     end
 
@@ -118,18 +118,18 @@ describe firewallchain do
 
   describe 'autorequire packages' do
     it "provider iptables_chain should autorequire package iptables" do
-      resource[:provider].should == :iptables_chain
+      expect(resource[:provider]).to eql :iptables_chain
       package = Puppet::Type.type(:package).new(:name => 'iptables')
       catalog = Puppet::Resource::Catalog.new
       catalog.add_resource resource
       catalog.add_resource package
       rel = resource.autorequire[0]
-      rel.source.ref.should == package.ref
-      rel.target.ref.should == resource.ref
+      expect(rel.source.ref).to eql package.ref
+      expect(rel.target.ref).to eql resource.ref
     end
 
     it "provider iptables_chain should autorequire packages iptables, iptables-persistent, and iptables-services" do
-      resource[:provider].should == :iptables_chain
+      expect(resource[:provider]).to eql :iptables_chain
       packages = [
         Puppet::Type.type(:package).new(:name => 'iptables'),
         Puppet::Type.type(:package).new(:name => 'iptables-persistent'),
@@ -141,8 +141,8 @@ describe firewallchain do
         catalog.add_resource package
       end
       packages.zip(resource.autorequire) do |package, rel|
-        rel.source.ref.should == package.ref
-        rel.target.ref.should == resource.ref
+        expect(rel.source.ref).to eql package.ref
+        expect(rel.target.ref).to eql resource.ref
       end
     end
   end
index 18d8af1b58116836b5480e42263edb7740ad1306..a55ed876d81bb04ff38e5dcd24463c6a8f4802c4 100644 (file)
@@ -13,37 +13,37 @@ describe 'Puppet::Util::Firewall' do
 
   describe '#host_to_ip' do
     subject { resource }
-    specify {
+    it {
       expect(Resolv).to receive(:getaddress).with('puppetlabs.com').and_return('96.126.112.51')
-      subject.host_to_ip('puppetlabs.com').should == '96.126.112.51/32'
+      expect(subject.host_to_ip('puppetlabs.com')).to eql '96.126.112.51/32'
     }
-    specify { subject.host_to_ip('96.126.112.51').should == '96.126.112.51/32' }
-    specify { subject.host_to_ip('96.126.112.51/32').should == '96.126.112.51/32' }
-    specify { subject.host_to_ip('2001:db8:85a3:0:0:8a2e:370:7334').should == '2001:db8:85a3::8a2e:370:7334/128' }
-    specify { subject.host_to_ip('2001:db8:1234::/48').should == '2001:db8:1234::/48' }
-    specify { subject.host_to_ip('0.0.0.0/0').should == nil }
-    specify { subject.host_to_ip('::/0').should == nil }
+    it { expect(subject.host_to_ip('96.126.112.51')).to eql '96.126.112.51/32' }
+    it { expect(subject.host_to_ip('96.126.112.51/32')).to eql '96.126.112.51/32' }
+    it { expect(subject.host_to_ip('2001:db8:85a3:0:0:8a2e:370:7334')).to eql '2001:db8:85a3::8a2e:370:7334/128' }
+    it { expect(subject.host_to_ip('2001:db8:1234::/48')).to eql '2001:db8:1234::/48' }
+    it { expect(subject.host_to_ip('0.0.0.0/0')).to eql nil }
+    it { expect(subject.host_to_ip('::/0')).to eql nil }
   end
 
   describe '#host_to_mask' do
     subject { resource }
-    specify {
+    it {
       expect(Resolv).to receive(:getaddress).at_least(:once).with('puppetlabs.com').and_return('96.126.112.51')
-      subject.host_to_mask('puppetlabs.com').should == '96.126.112.51/32'
-      subject.host_to_mask('!puppetlabs.com').should == '! 96.126.112.51/32'
+      expect(subject.host_to_mask('puppetlabs.com')).to eql '96.126.112.51/32'
+      expect(subject.host_to_mask('!puppetlabs.com')).to eql '! 96.126.112.51/32'
     }
-    specify { subject.host_to_mask('96.126.112.51').should == '96.126.112.51/32' }
-    specify { subject.host_to_mask('!96.126.112.51').should == '! 96.126.112.51/32' }
-    specify { subject.host_to_mask('96.126.112.51/32').should == '96.126.112.51/32' }
-    specify { subject.host_to_mask('! 96.126.112.51/32').should == '! 96.126.112.51/32' }
-    specify { subject.host_to_mask('2001:db8:85a3:0:0:8a2e:370:7334').should == '2001:db8:85a3::8a2e:370:7334/128' }
-    specify { subject.host_to_mask('!2001:db8:85a3:0:0:8a2e:370:7334').should == '! 2001:db8:85a3::8a2e:370:7334/128' }
-    specify { subject.host_to_mask('2001:db8:1234::/48').should == '2001:db8:1234::/48' }
-    specify { subject.host_to_mask('! 2001:db8:1234::/48').should == '! 2001:db8:1234::/48' }
-    specify { subject.host_to_mask('0.0.0.0/0').should == nil }
-    specify { subject.host_to_mask('!0.0.0.0/0').should == nil }
-    specify { subject.host_to_mask('::/0').should == nil }
-    specify { subject.host_to_mask('! ::/0').should == nil }
+    it { expect(subject.host_to_mask('96.126.112.51')).to eql '96.126.112.51/32' }
+    it { expect(subject.host_to_mask('!96.126.112.51')).to eql '! 96.126.112.51/32' }
+    it { expect(subject.host_to_mask('96.126.112.51/32')).to eql '96.126.112.51/32' }
+    it { expect(subject.host_to_mask('! 96.126.112.51/32')).to eql '! 96.126.112.51/32' }
+    it { expect(subject.host_to_mask('2001:db8:85a3:0:0:8a2e:370:7334')).to eql '2001:db8:85a3::8a2e:370:7334/128' }
+    it { expect(subject.host_to_mask('!2001:db8:85a3:0:0:8a2e:370:7334')).to eql '! 2001:db8:85a3::8a2e:370:7334/128' }
+    it { expect(subject.host_to_mask('2001:db8:1234::/48')).to eql '2001:db8:1234::/48' }
+    it { expect(subject.host_to_mask('! 2001:db8:1234::/48')).to eql '! 2001:db8:1234::/48' }
+    it { expect(subject.host_to_mask('0.0.0.0/0')).to eql nil }
+    it { expect(subject.host_to_mask('!0.0.0.0/0')).to eql nil }
+    it { expect(subject.host_to_mask('::/0')).to eql nil }
+    it { expect(subject.host_to_mask('! ::/0')).to eql nil }
   end
 
   describe '#icmp_name_to_number' do
@@ -61,54 +61,54 @@ describe 'Puppet::Util::Firewall' do
     describe 'proto IPv4' do
       proto = 'inet'
       subject { resource }
-      specify { subject.icmp_name_to_number('echo-reply', proto).should == '0' }
-      specify { subject.icmp_name_to_number('destination-unreachable', proto).should == '3' }
-      specify { subject.icmp_name_to_number('source-quench', proto).should == '4' }
-      specify { subject.icmp_name_to_number('redirect', proto).should == '6' }
-      specify { subject.icmp_name_to_number('echo-request', proto).should == '8' }
-      specify { subject.icmp_name_to_number('router-advertisement', proto).should == '9' }
-      specify { subject.icmp_name_to_number('router-solicitation', proto).should == '10' }
-      specify { subject.icmp_name_to_number('time-exceeded', proto).should == '11' }
-      specify { subject.icmp_name_to_number('parameter-problem', proto).should == '12' }
-      specify { subject.icmp_name_to_number('timestamp-request', proto).should == '13' }
-      specify { subject.icmp_name_to_number('timestamp-reply', proto).should == '14' }
-      specify { subject.icmp_name_to_number('address-mask-request', proto).should == '17' }
-      specify { subject.icmp_name_to_number('address-mask-reply', proto).should == '18' }
+      it { expect(subject.icmp_name_to_number('echo-reply', proto)).to eql '0' }
+      it { expect(subject.icmp_name_to_number('destination-unreachable', proto)).to eql '3' }
+      it { expect(subject.icmp_name_to_number('source-quench', proto)).to eql '4' }
+      it { expect(subject.icmp_name_to_number('redirect', proto)).to eql '6' }
+      it { expect(subject.icmp_name_to_number('echo-request', proto)).to eql '8' }
+      it { expect(subject.icmp_name_to_number('router-advertisement', proto)).to eql '9' }
+      it { expect(subject.icmp_name_to_number('router-solicitation', proto)).to eql '10' }
+      it { expect(subject.icmp_name_to_number('time-exceeded', proto)).to eql '11' }
+      it { expect(subject.icmp_name_to_number('parameter-problem', proto)).to eql '12' }
+      it { expect(subject.icmp_name_to_number('timestamp-request', proto)).to eql '13' }
+      it { expect(subject.icmp_name_to_number('timestamp-reply', proto)).to eql '14' }
+      it { expect(subject.icmp_name_to_number('address-mask-request', proto)).to eql '17' }
+      it { expect(subject.icmp_name_to_number('address-mask-reply', proto)).to eql '18' }
     end
 
     describe 'proto IPv6' do
       proto = 'inet6'
       subject { resource }
-      specify { subject.icmp_name_to_number('destination-unreachable', proto).should == '1' }
-      specify { subject.icmp_name_to_number('time-exceeded', proto).should == '3' }
-      specify { subject.icmp_name_to_number('parameter-problem', proto).should == '4' }
-      specify { subject.icmp_name_to_number('echo-request', proto).should == '128' }
-      specify { subject.icmp_name_to_number('echo-reply', proto).should == '129' }
-      specify { subject.icmp_name_to_number('router-solicitation', proto).should == '133' }
-      specify { subject.icmp_name_to_number('router-advertisement', proto).should == '134' }
-      specify { subject.icmp_name_to_number('neighbour-solicitation', proto).should == '135' }
-      specify { subject.icmp_name_to_number('neighbour-advertisement', proto).should == '136' }
-      specify { subject.icmp_name_to_number('redirect', proto).should == '137' }
+      it { expect(subject.icmp_name_to_number('destination-unreachable', proto)).to eql '1' }
+      it { expect(subject.icmp_name_to_number('time-exceeded', proto)).to eql '3' }
+      it { expect(subject.icmp_name_to_number('parameter-problem', proto)).to eql '4' }
+      it { expect(subject.icmp_name_to_number('echo-request', proto)).to eql '128' }
+      it { expect(subject.icmp_name_to_number('echo-reply', proto)).to eql '129' }
+      it { expect(subject.icmp_name_to_number('router-solicitation', proto)).to eql '133' }
+      it { expect(subject.icmp_name_to_number('router-advertisement', proto)).to eql '134' }
+      it { expect(subject.icmp_name_to_number('neighbour-solicitation', proto)).to eql '135' }
+      it { expect(subject.icmp_name_to_number('neighbour-advertisement', proto)).to eql '136' }
+      it { expect(subject.icmp_name_to_number('redirect', proto)).to eql '137' }
     end
   end
 
   describe '#string_to_port' do
     subject { resource }
-    specify { subject.string_to_port('80','tcp').should == '80' }
-    specify { subject.string_to_port(80,'tcp').should == '80' }
-    specify { subject.string_to_port('http','tcp').should == '80' }
-    specify { subject.string_to_port('domain','udp').should == '53' }
+    it { expect(subject.string_to_port('80','tcp')).to eql '80' }
+    it { expect(subject.string_to_port(80,'tcp')).to eql '80' }
+    it { expect(subject.string_to_port('http','tcp')).to eql '80' }
+    it { expect(subject.string_to_port('domain','udp')).to eql '53' }
   end
 
   describe '#to_hex32' do
     subject { resource }
-    specify { subject.to_hex32('0').should == '0x0' }
-    specify { subject.to_hex32('0x32').should == '0x32' }
-    specify { subject.to_hex32('42').should == '0x2a' }
-    specify { subject.to_hex32('4294967295').should == '0xffffffff' }
-    specify { subject.to_hex32('4294967296').should == nil }
-    specify { subject.to_hex32('-1').should == nil }
-    specify { subject.to_hex32('bananas').should == nil }
+    it { expect(subject.to_hex32('0')).to eql '0x0' }
+    it { expect(subject.to_hex32('0x32')).to eql '0x32' }
+    it { expect(subject.to_hex32('42')).to eql '0x2a' }
+    it { expect(subject.to_hex32('4294967295')).to eql '0xffffffff' }
+    it { expect(subject.to_hex32('4294967296')).to eql nil }
+    it { expect(subject.to_hex32('-1')).to eql nil }
+    it { expect(subject.to_hex32('bananas')).to eql nil }
   end
 
   describe '#persist_iptables' do
@@ -118,7 +118,7 @@ describe 'Puppet::Util::Firewall' do
     describe 'when proto is IPv4' do
       let(:proto) { 'IPv4' }
 
-      it 'should exec /sbin/service if running RHEL 6 or earlier' do
+      it 'is expected to exec /sbin/service if running RHEL 6 or earlier' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('6')
@@ -127,7 +127,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should exec for systemd if running RHEL 7 or greater' do
+      it 'is expected to exec for systemd if running RHEL 7 or greater' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('7')
@@ -136,7 +136,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should exec for systemd if running Fedora 15 or greater' do
+      it 'is expected to exec for systemd if running Fedora 15 or greater' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Fedora')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('15')
@@ -145,7 +145,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should exec for CentOS 6 identified from operatingsystem and operatingsystemrelease' do
+      it 'is expected to exec for CentOS 6 identified from operatingsystem and operatingsystemrelease' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('6.5')
@@ -153,7 +153,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should exec for CentOS 7 identified from operatingsystem and operatingsystemrelease' do
+      it 'is expected to exec for CentOS 7 identified from operatingsystem and operatingsystemrelease' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('7.0.1406')
@@ -161,13 +161,13 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should exec for Archlinux identified from osfamily' do
+      it 'is expected to exec for Archlinux identified from osfamily' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('Archlinux')
         expect(subject).to receive(:execute).with(['/bin/sh', '-c', '/usr/sbin/iptables-save > /etc/iptables/iptables.rules'])
         subject.persist_iptables(proto)
       end
 
-      it 'should raise a warning when exec fails' do
+      it 'is expected to raise a warning when exec fails' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('RedHat')
         allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('6')
@@ -182,7 +182,7 @@ describe 'Puppet::Util::Firewall' do
     describe 'when proto is IPv6' do
       let(:proto) { 'IPv6' }
 
-      it 'should exec for newer Ubuntu' do
+      it 'is expected to exec for newer Ubuntu' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu')
         allow(Facter.fact(:iptables_persistent_version)).to receive(:value).and_return('0.5.3ubuntu2')
@@ -190,7 +190,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should not exec for older Ubuntu which does not support IPv6' do
+      it 'is expected to not exec for older Ubuntu which does not support IPv6' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
         allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu')
         allow(Facter.fact(:iptables_persistent_version)).to receive(:value).and_return('0.0.20090701')
@@ -198,7 +198,7 @@ describe 'Puppet::Util::Firewall' do
         subject.persist_iptables(proto)
       end
 
-      it 'should not exec for Suse which is not supported' do
+      it 'is expected to not exec for Suse which is not supported' do
         allow(Facter.fact(:osfamily)).to receive(:value).and_return('Suse')
         expect(subject).to receive(:execute).never
         subject.persist_iptables(proto)
index df73ae536ad5084f0dbda63b3b84d424fd3959e2..8f718d2e1da6a292f7ed982299c3c6ae0926d8ae 100644 (file)
@@ -4,25 +4,25 @@ describe 'Puppet::Util::IPCidr' do
   describe 'ipv4 address' do
     before { @ipaddr = Puppet::Util::IPCidr.new('96.126.112.51') }
     subject { @ipaddr }
-    specify { subject.cidr.should == '96.126.112.51/32' }
-    specify { subject.prefixlen.should == 32 }
-    specify { subject.netmask.should == '255.255.255.255' }
+    it { expect(subject.cidr).to eql '96.126.112.51/32' }
+    it { expect(subject.prefixlen).to eql 32 }
+    it { expect(subject.netmask).to eql '255.255.255.255' }
   end
 
   describe 'single ipv4 address with cidr' do
     before { @ipcidr = Puppet::Util::IPCidr.new('96.126.112.51/32') }
     subject { @ipcidr }
-    specify { subject.cidr.should == '96.126.112.51/32' }
-    specify { subject.prefixlen.should == 32 }
-    specify { subject.netmask.should == '255.255.255.255' }
+    it { expect(subject.cidr).to eql '96.126.112.51/32' }
+    it { expect(subject.prefixlen).to eql 32 }
+    it { expect(subject.netmask).to eql '255.255.255.255' }
   end
 
   describe 'ipv4 address range with cidr' do
     before { @ipcidr = Puppet::Util::IPCidr.new('96.126.112.0/24') }
     subject { @ipcidr }
-    specify { subject.cidr.should == '96.126.112.0/24' }
-    specify { subject.prefixlen.should == 24 }
-    specify { subject.netmask.should == '255.255.255.0' }
+    it { expect(subject.cidr).to eql '96.126.112.0/24' }
+    it { expect(subject.prefixlen).to eql 24 }
+    it { expect(subject.netmask).to eql '255.255.255.0' }
   end
 
   # https://tickets.puppetlabs.com/browse/MODULES-3215
@@ -38,40 +38,40 @@ describe 'Puppet::Util::IPCidr' do
   describe 'ipv4 open range with cidr' do
     before { @ipcidr = Puppet::Util::IPCidr.new('0.0.0.0/0') }
     subject { @ipcidr }
-    specify { subject.cidr.should == '0.0.0.0/0' }
-    specify { subject.prefixlen.should == 0 }
-    specify { subject.netmask.should == '0.0.0.0' }
+    it { expect(subject.cidr).to eql '0.0.0.0/0' }
+    it { expect(subject.prefixlen).to eql 0 }
+    it { expect(subject.netmask).to eql '0.0.0.0' }
   end
 
   describe 'ipv6 address' do
     before { @ipaddr = Puppet::Util::IPCidr.new('2001:db8:85a3:0:0:8a2e:370:7334') }
     subject { @ipaddr }
-    specify { subject.cidr.should == '2001:db8:85a3::8a2e:370:7334/128' }
-    specify { subject.prefixlen.should == 128 }
-    specify { subject.netmask.should == 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' }
+    it { expect(subject.cidr).to eql '2001:db8:85a3::8a2e:370:7334/128' }
+    it { expect(subject.prefixlen).to eql 128 }
+    it { expect(subject.netmask).to eql 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' }
   end
 
   describe 'single ipv6 addr with cidr' do
     before { @ipaddr = Puppet::Util::IPCidr.new('2001:db8:85a3:0:0:8a2e:370:7334/128') }
     subject { @ipaddr }
-    specify { subject.cidr.should == '2001:db8:85a3::8a2e:370:7334/128' }
-    specify { subject.prefixlen.should == 128 }
-    specify { subject.netmask.should == 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' }
+    it { expect(subject.cidr).to eql '2001:db8:85a3::8a2e:370:7334/128' }
+    it { expect(subject.prefixlen).to eql 128 }
+    it { expect(subject.netmask).to eql 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' }
   end
 
   describe 'ipv6 addr range with cidr' do
     before { @ipaddr = Puppet::Util::IPCidr.new('2001:db8:1234::/48') }
     subject { @ipaddr }
-    specify { subject.cidr.should == '2001:db8:1234::/48' }
-    specify { subject.prefixlen.should == 48 }
-    specify { subject.netmask.should == 'ffff:ffff:ffff:0000:0000:0000:0000:0000' }
+    it { expect(subject.cidr).to eql '2001:db8:1234::/48' }
+    it { expect(subject.prefixlen).to eql 48 }
+    it { expect(subject.netmask).to eql 'ffff:ffff:ffff:0000:0000:0000:0000:0000' }
   end
 
   describe 'ipv6 open range with cidr' do
     before { @ipaddr = Puppet::Util::IPCidr.new('::/0') }
     subject { @ipaddr }
-    specify { subject.cidr.should == '::/0' }
-    specify { subject.prefixlen.should == 0 }
-    specify { subject.netmask.should == '0000:0000:0000:0000:0000:0000:0000:0000' }
+    it { expect(subject.cidr).to eql '::/0' }
+    it { expect(subject.prefixlen).to eql 0 }
+    it { expect(subject.netmask).to eql '0000:0000:0000:0000:0000:0000:0000:0000' }
   end
 end