spec/iptables_spec.rb in shutter-0.1.0 vs spec/iptables_spec.rb in shutter-0.2.0
- old
+ new
@@ -51,9 +51,21 @@
@ipt.dmz_device_block.should == %q{-A Dmz -i eth0 -j ACCEPT
-A Dmz -i eth1 -j ACCEPT
}
end
+ it "should return true if generated rules and iptables-save rules match" do
+ iptables_save = File.read("./spec/files/iptables_save_bare.out")
+ @ipt.stubs(:iptables_save).returns(iptables_save)
+ @ipt.check.should == true
+ end
+
+ it "should return false if generated rules and iptables-save rules don't match" do
+ iptables_save = File.read("./spec/files/iptables_save_extrarules.out")
+ @ipt.stubs(:iptables_save).returns(iptables_save)
+ @ipt.check.should == false
+ end
+
it "should return the correct output for generate" do
iptables_save = File.read("./spec/files/iptables_save.out")
@ipt.stubs(:iptables_save).returns(iptables_save)
@ipt.generate.should == %q{*filter
:INPUT DROP [0:0]