Skip to content
Browse files

Add a more complex spec that ties the various mixins together

  • Loading branch information...
1 parent e2b681d commit 71546125440e00c68957d471e7c5bc1552050a83 @rodjek committed Jun 4, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 spec/iptables/complex_spec.rb
View
24 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

0 comments on commit 7154612

Please sign in to comment.
Something went wrong with that request. Please try again.