Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a more complex spec that ties the various mixins together
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |