# --tcp-flags takes two values; we cheat by adding " around it
# so it behaves like --comment
values = values.sub(/--tcp-flags (\S*) (\S*)/, '--tcp-flags "\1 \2"')
- # we do a simular thing for negated address masks (source and destination).
+ # we do a similar thing for negated address masks (source and destination).
values = values.sub(/(-\S+) (!)\s?(\S*)/,'\1 "\2 \3"')
# the actual rule will have the ! mark before the option.
values = values.sub(/(!)\s*(-\S+)\s*(\S*)/, '\2 "\1 \3"')
describe '#host_to_mask' do
subject { resource }
- specify { subject.host_to_mask('puppetlabs.com').should == '96.126.112.51/32' }
- specify { subject.host_to_mask('!puppetlabs.com').should == '! 96.126.112.51/32' }
+ specify {
+ expect(Resolv).to receive(:getaddress).any_number_of_times.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'
+ }
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' }