Sha256: 2c35f0aeae13512a82bccaf43efccb182c2ec615d2da1f093124156fbc81337f

Contents?: true

Size: 609 Bytes

Versions: 33

Compression:

Stored size: 609 Bytes

Contents

RSpec::Matchers.define :have_rule do |rule|
  match do |subject|
    if subject.class.name == 'Serverspec::Type::Iptables' || subject.class.name == 'Serverspec::Type::Ip6tables'
      subject.has_rule?(rule, @table, @chain)
    else
      subject.has_rule?(rule)
    end
  end

  description do
    message = %Q{have rule "#{rule}"}
    message << " with table #{@table}" if @table
    message << ' and' if @table && @chain
    message << " with chain #{@chain}" if @chain
    message
  end

  chain :with_table do |table|
    @table = table
  end

  chain :with_chain do |chain|
    @chain = chain
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
serverspec-2.37.2 lib/serverspec/matcher/have_rule.rb
serverspec-2.37.1 lib/serverspec/matcher/have_rule.rb
serverspec-2.37.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.36.1 lib/serverspec/matcher/have_rule.rb
serverspec-2.36.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.35.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.34.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.33.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.32.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.31.1 lib/serverspec/matcher/have_rule.rb
serverspec-2.31.0 lib/serverspec/matcher/have_rule.rb
serverspec-2.30.1 lib/serverspec/matcher/have_rule.rb
serverspec-2.30.0 lib/serverspec/matcher/have_rule.rb