|
34 | 34 | end |
35 | 35 |
|
36 | 36 | 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) |
38 | 38 | end |
39 | 39 | end |
40 | 40 |
|
|
52 | 52 | end |
53 | 53 |
|
54 | 54 | 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) |
56 | 56 | end |
57 | 57 | end |
58 | 58 |
|
|
65 | 65 | end |
66 | 66 |
|
67 | 67 | 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) |
69 | 69 | end |
70 | 70 | end |
71 | 71 |
|
|
78 | 78 | end |
79 | 79 |
|
80 | 80 | 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) |
82 | 82 | end |
83 | 83 | end |
84 | 84 |
|
|
91 | 91 | end |
92 | 92 |
|
93 | 93 | 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) |
95 | 95 | end |
96 | 96 | end |
97 | 97 |
|
|
110 | 110 |
|
111 | 111 | ['ACCEPT', 'DROP', 'REJECT'].each do |jump| |
112 | 112 | 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) |
114 | 114 | end |
115 | 115 | end |
116 | 116 |
|
117 | 117 | 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) |
119 | 119 | end |
120 | 120 | end |
121 | 121 |
|
|
241 | 241 | end |
242 | 242 |
|
243 | 243 | 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) |
245 | 245 | end |
246 | 246 | end |
247 | 247 |
|
|
295 | 295 | expect(resource[:log_level]).to be 3 |
296 | 296 | } |
297 | 297 |
|
298 | | - it { expect(-> { resource[:log_level] = 'foo' }).to raise_error(Puppet::Error) } |
| 298 | + it { expect { resource[:log_level] = 'foo' }.to raise_error(Puppet::Error) } |
299 | 299 | end |
300 | 300 | end |
301 | 301 |
|
|
310 | 310 |
|
311 | 311 | [-3, 999_999].each do |v| |
312 | 312 | 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}) |
314 | 314 | } |
315 | 315 | end |
316 | 316 | end |
|
325 | 325 | } |
326 | 326 |
|
327 | 327 | 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}) |
329 | 329 | } |
330 | 330 | end |
331 | 331 | end |
|
381 | 381 | end |
382 | 382 |
|
383 | 383 | 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) |
385 | 385 | end |
386 | 386 | 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) |
388 | 388 | end |
389 | 389 |
|
390 | 390 | 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) |
392 | 392 | end |
393 | 393 | end |
394 | 394 |
|
|
603 | 603 | end |
604 | 604 |
|
605 | 605 | 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) |
607 | 607 | end |
608 | 608 | 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) |
610 | 610 | end |
611 | 611 | end |
612 | 612 |
|
|
665 | 665 | expect(resource[:set_mark]).to eql '0x3e8' |
666 | 666 | end |
667 | 667 | 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( |
669 | 669 | Puppet::Error, %r{iptables version #{iptables_version} does not support masks on MARK rules$} |
670 | 670 | ) |
671 | 671 | end |
|
693 | 693 | expect(resource[:set_mark]).to eql '0x3e8/0x4' |
694 | 694 | end |
695 | 695 | 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( |
697 | 697 | Puppet::Error, %r{MARK mask must be integer or hex between 0 and 0xffffffff$} |
698 | 698 | ) |
699 | 699 | end |
700 | 700 | 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( |
702 | 702 | Puppet::Error, %r{MARK mask must be integer or hex between 0 and 0xffffffff$} |
703 | 703 | ) |
704 | 704 | end |
705 | 705 | end |
706 | 706 |
|
707 | 707 | ['/', '1000/', 'pwnie'].each do |bad_mark| |
708 | 708 | 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) |
710 | 710 | end |
711 | 711 | end |
712 | 712 | 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( |
714 | 714 | Puppet::Error, %r{MARK value must be integer or hex between 0 and 0xffffffff$} |
715 | 715 | ) |
716 | 716 | end |
|
877 | 877 | end |
878 | 878 |
|
879 | 879 | 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) |
881 | 881 | end |
882 | 882 | end |
883 | 883 |
|
|
0 commit comments