Skip to content

Commit ebabdc3

Browse files
Address deprecation message spam in test output
Take a few minutes and address the 40+ lines of deprecation warnings from the test framework, so nobody has to get constantly spammed while trying to do module development anymore.
1 parent 52706d3 commit ebabdc3

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

spec/unit/puppet/type/firewall_spec.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
end
3535

3636
it 'does not accept a name with non-ASCII chars' do
37-
expect(-> { resource[:name] = '%*#^(#$' }).to raise_error(Puppet::Error)
37+
expect { resource[:name] = '%*#^(#$' }.to raise_error(Puppet::Error)
3838
end
3939
end
4040

@@ -52,7 +52,7 @@
5252
end
5353

5454
it 'fails when value is not recognized' do
55-
expect(-> { resource[:action] = 'not valid' }).to raise_error(Puppet::Error)
55+
expect { resource[:action] = 'not valid' }.to raise_error(Puppet::Error)
5656
end
5757
end
5858

@@ -65,7 +65,7 @@
6565
end
6666

6767
it 'fails when the chain value is not recognized' do
68-
expect(-> { resource[:chain] = 'not valid' }).to raise_error(Puppet::Error)
68+
expect { resource[:chain] = 'not valid' }.to raise_error(Puppet::Error)
6969
end
7070
end
7171

@@ -78,7 +78,7 @@
7878
end
7979

8080
it 'fails when table value is not recognized' do
81-
expect(-> { resource[:table] = 'not valid' }).to raise_error(Puppet::Error)
81+
expect { resource[:table] = 'not valid' }.to raise_error(Puppet::Error)
8282
end
8383
end
8484

@@ -91,7 +91,7 @@
9191
end
9292

9393
it 'fails when proto value is not recognized' do
94-
expect(-> { resource[:proto] = 'foo' }).to raise_error(Puppet::Error)
94+
expect { resource[:proto] = 'foo' }.to raise_error(Puppet::Error)
9595
end
9696
end
9797

@@ -110,12 +110,12 @@
110110

111111
['ACCEPT', 'DROP', 'REJECT'].each do |jump|
112112
it "nows fail when value #{jump}" do
113-
expect(-> { resource[:jump] = jump }).to raise_error(Puppet::Error)
113+
expect { resource[:jump] = jump }.to raise_error(Puppet::Error)
114114
end
115115
end
116116

117117
it 'fails when jump value is not recognized' do
118-
expect(-> { resource[:jump] = '%^&*' }).to raise_error(Puppet::Error)
118+
expect { resource[:jump] = '%^&*' }.to raise_error(Puppet::Error)
119119
end
120120
end
121121

@@ -241,7 +241,7 @@
241241
end
242242

243243
it "fails when #{addrtype} value is not recognized" do
244-
expect(-> { resource[addrtype] = 'foo' }).to raise_error(Puppet::Error)
244+
expect { resource[addrtype] = 'foo' }.to raise_error(Puppet::Error)
245245
end
246246
end
247247

@@ -295,7 +295,7 @@
295295
expect(resource[:log_level]).to be 3
296296
}
297297

298-
it { expect(-> { resource[:log_level] = 'foo' }).to raise_error(Puppet::Error) }
298+
it { expect { resource[:log_level] = 'foo' }.to raise_error(Puppet::Error) }
299299
end
300300
end
301301

@@ -310,7 +310,7 @@
310310

311311
[-3, 999_999].each do |v|
312312
it {
313-
expect(-> { resource[:nflog_group] = v }).to raise_error(Puppet::Error, %r{2\^16\-1})
313+
expect { resource[:nflog_group] = v }.to raise_error(Puppet::Error, %r{2\^16\-1})
314314
}
315315
end
316316
end
@@ -325,7 +325,7 @@
325325
}
326326

327327
it {
328-
expect(-> { resource[:nflog_prefix] = invalid_prefix }).to raise_error(Puppet::Error, %r{64 characters})
328+
expect { resource[:nflog_prefix] = invalid_prefix }.to raise_error(Puppet::Error, %r{64 characters})
329329
}
330330
end
331331
end
@@ -381,14 +381,14 @@
381381
end
382382

383383
it 'fails if icmp type is "any"' do
384-
expect(-> { resource[:icmp] = 'any' }).to raise_error(Puppet::Error)
384+
expect { resource[:icmp] = 'any' }.to raise_error(Puppet::Error)
385385
end
386386
it 'fails if icmp type is an array' do
387-
expect(-> { resource[:icmp] = "['0', '8']" }).to raise_error(Puppet::Error)
387+
expect { resource[:icmp] = "['0', '8']" }.to raise_error(Puppet::Error)
388388
end
389389

390390
it 'fails if icmp type cannot be mapped to a numeric' do
391-
expect(-> { resource[:icmp] = 'foo' }).to raise_error(Puppet::Error)
391+
expect { resource[:icmp] = 'foo' }.to raise_error(Puppet::Error)
392392
end
393393
end
394394

@@ -603,10 +603,10 @@
603603
end
604604

605605
it 'fails if value is not numeric' do
606-
expect(-> { resource[:burst] = 'foo' }).to raise_error(Puppet::Error)
606+
expect { resource[:burst] = 'foo' }.to raise_error(Puppet::Error)
607607
end
608608
it 'fails if value contains /sec' do
609-
expect(-> { resource[:burst] = '1500/sec' }).to raise_error(Puppet::Error)
609+
expect { resource[:burst] = '1500/sec' }.to raise_error(Puppet::Error)
610610
end
611611
end
612612

@@ -665,7 +665,7 @@
665665
expect(resource[:set_mark]).to eql '0x3e8'
666666
end
667667
it 'fails if mask is present' do
668-
expect(-> { resource[:set_mark] = '0x3e8/0xffffffff' }).to raise_error(
668+
expect { resource[:set_mark] = '0x3e8/0xffffffff' }.to raise_error(
669669
Puppet::Error, %r{iptables version #{iptables_version} does not support masks on MARK rules$}
670670
)
671671
end
@@ -693,24 +693,24 @@
693693
expect(resource[:set_mark]).to eql '0x3e8/0x4'
694694
end
695695
it 'fails if mask value is more than 32 bits' do
696-
expect(-> { resource[:set_mark] = '1/4294967296' }).to raise_error(
696+
expect { resource[:set_mark] = '1/4294967296' }.to raise_error(
697697
Puppet::Error, %r{MARK mask must be integer or hex between 0 and 0xffffffff$}
698698
)
699699
end
700700
it 'fails if mask is malformed' do
701-
expect(-> { resource[:set_mark] = '1000/0xq4' }).to raise_error(
701+
expect { resource[:set_mark] = '1000/0xq4' }.to raise_error(
702702
Puppet::Error, %r{MARK mask must be integer or hex between 0 and 0xffffffff$}
703703
)
704704
end
705705
end
706706

707707
['/', '1000/', 'pwnie'].each do |bad_mark|
708708
it "fails with malformed mark '#{bad_mark}'" do
709-
expect(-> { resource[:set_mark] = bad_mark }).to raise_error(Puppet::Error)
709+
expect { resource[:set_mark] = bad_mark }.to raise_error(Puppet::Error)
710710
end
711711
end
712712
it 'fails if mark value is more than 32 bits' do
713-
expect(-> { resource[:set_mark] = '4294967296' }).to raise_error(
713+
expect { resource[:set_mark] = '4294967296' }.to raise_error(
714714
Puppet::Error, %r{MARK value must be integer or hex between 0 and 0xffffffff$}
715715
)
716716
end
@@ -877,7 +877,7 @@
877877
end
878878

879879
it 'fails when the pkttype value is not recognized' do
880-
expect(-> { resource[:pkttype] = 'not valid' }).to raise_error(Puppet::Error)
880+
expect { resource[:pkttype] = 'not valid' }.to raise_error(Puppet::Error)
881881
end
882882
end
883883

spec/unit/puppet/util/ipcidr_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040

4141
let(:ipcidr) { Puppet::Util::IPCidr.new('96.126.112.20/24') }
4242

43-
specify { host.cidr.should == '96.126.112.0/24' } # .20 is expected to
43+
it { expect(host.cidr).to eql '96.126.112.0/24' } # .20 is expected to
4444
# be silently dropped.
45-
specify { host.prefixlen.should == 24 }
46-
specify { host.netmask.should == '255.255.255.0' }
45+
it { expect(host.prefixlen).to be 24 }
46+
it { expect(host.netmask).to eql '255.255.255.0' }
4747
end
4848

4949
describe 'ipv4 open range with cidr' do

0 commit comments

Comments
 (0)