Sha256: 55bea9aec6a90c68321799a302540131f8747d62de394550d214e60a7ee90cb0

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Asbestos::RuleSet do
  before(:each) do
    Asbestos.reset!
  end

  context "the 'rule_set' DSL call" do
    it "should store the block as a template" do

      block = proc do;
      end

      rule_set 'rulesetname', &block

      Asbestos::RuleSet[:rulesetname].should be block
    end
  end

  context "context DSL" do
    [:rule, :accept, :reject, :drop, :log].each do |action|
      it "should send '#{action}' to the firewall module" do

        Asbestos.firewall.should_receive action

        rule_set 'rulesetname' do
          eval "#{action} :chain => 'input', :remote_address => '224.0.0.0/4'"
        end

        host 'hostname' do
          rulesetname
        end

        Host['hostname'].call.ruleset_rules
      end
    end

    it "should add raw commands with 'command'" do
      rule_set 'rulesetname' do
        command "some raw firewall command"
      end

      host 'hostname' do
        rulesetname
      end

      Host['hostname'].call.rules.join("\n").should match(/some raw firewall command/)
    end

    it "should generate firewall rules properly"
    it "should handle the :from argument to from_each properly"
    it "should handle the :from argument to from_each_address properly"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
asbestos-0.0.9 spec/asbestos/rule_set_spec.rb
asbestos-0.0.8 spec/asbestos/rule_set_spec.rb
asbestos-0.0.7 spec/asbestos/rule_set_spec.rb
asbestos-0.0.6 spec/asbestos/rule_set_spec.rb
asbestos-0.0.5 spec/asbestos/rule_set_spec.rb
asbestos-0.0.4 spec/asbestos/rule_set_spec.rb
asbestos-0.0.3 spec/asbestos/rule_set_spec.rb
asbestos-0.0.1 spec/asbestos/rule_set_spec.rb