Sha256: 2dcd678f02292e45e13e4a462e809ff7dced67c6a8c76aee5df566b5ec006957

Contents?: true

Size: 881 Bytes

Versions: 5

Compression:

Stored size: 881 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'
require 'facter/util/ip'

shared_examples_for "ifconfig output" do |platform, address, fixture|
  it "correctly on #{platform}" do
    Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read(fixture))
    subject.value.should == address
  end
end

RSpec.configure do |config|
  config.alias_it_should_behave_like_to :example_behavior_for, "parses"
end

describe "The ipaddress fact" do
  subject do
    Facter.collection.internal_loader.load(:ipaddress)
    Facter.fact(:ipaddress)
  end
  context "on Linux" do
    before :each do
      Facter.fact(:kernel).stubs(:value).returns("Linux")
    end

    example_behavior_for "ifconfig output",
      "Ubuntu 12.04", "10.87.80.110", "ifconfig_ubuntu_1204.txt"
    example_behavior_for "ifconfig output",
      "Fedora 17", "131.252.209.153", "ifconfig_net_tools_1.60.txt"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facter-1.7.1 spec/unit/ipaddress_spec.rb
facter-1.7.1.rc1 spec/unit/ipaddress_spec.rb
facter-1.7.0 spec/unit/ipaddress_spec.rb
facter-1.7.0.rc2 spec/unit/ipaddress_spec.rb
facter-1.7.0.rc1 spec/unit/ipaddress_spec.rb