view modules/firewall/spec/unit/facter/iptables_spec.rb @ 39:d6f2a0ee45c0 puppet-3.6

Add "Firewall" module
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2015 20:58:03 +0000
parents
children
line wrap: on
line source

require 'spec_helper'

describe "Facter::Util::Fact" do
  before {
    Facter.clear
    allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux')
    allow(Facter.fact(:kernelrelease)).to receive(:value).and_return('2.6')
  }

  describe 'iptables_version' do
    it {
      allow(Facter::Util::Resolution).to receive(:exec).with('iptables --version').
      and_return('iptables v1.4.7')
      Facter.fact(:iptables_version).value.should == '1.4.7'
    }
  end

  describe 'ip6tables_version' do
    before { allow(Facter::Util::Resolution).to receive(:exec).
             with('ip6tables --version').and_return('ip6tables v1.4.7') }
    it { Facter.fact(:ip6tables_version).value.should == '1.4.7' }
  end
end