From 71546125440e00c68957d471e7c5bc1552050a83 Mon Sep 17 00:00:00 2001 From: Tim Sharpe Date: Sat, 4 Jun 2011 11:58:22 +1000 Subject: [PATCH] Add a more complex spec that ties the various mixins together --- spec/iptables/complex_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spec/iptables/complex_spec.rb diff --git a/spec/iptables/complex_spec.rb b/spec/iptables/complex_spec.rb new file mode 100644 index 0000000..9305f9b --- /dev/null +++ b/spec/iptables/complex_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe IPTables::Rule do + context "when creating complex rules" do + describe "like allow traffic in on eth1 from 10.0.0.0/24 on port 443 with a new state" do + subject do + rule = IPTables::Rule.new + rule.chain = :input + rule.target = :accept + rule.protocol = :tcp + rule.source = '10.0.0.0/24' + rule.destination_port = 443 + rule.add_module 'state' + rule.state = :new + rule.in_interface = 'eth1' + rule + end + + its(:to_iptables) { + should == '-A INPUT -i eth1 -s 10.0.0.0/24 -p tcp --dport 443 -m state --state NEW -j ACCEPT' + } + end + end +end