Sha256: 360180b7d8f14ae190cb6b3390d2b802cb747553e9a228e176ef9812a3fe2123

Contents?: true

Size: 754 Bytes

Versions: 16

Compression:

Stored size: 754 Bytes

Contents

#! /usr/bin/env ruby

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

describe "Per Interface IP facts" do
  it "should replace the ':' in an interface list with '_'" do
    # So we look supported
    Facter.fact(:kernel).stubs(:value).returns("SunOS")

    Facter::Util::IP.stubs(:get_interfaces).returns %w{eth0:1 eth1:2}
    Facter.fact(:interfaces).value.should == %{eth0_1,eth1_2}
  end

  it "should replace non-alphanumerics in an interface list with '_'" do
    Facter.fact(:kernel).stubs(:value).returns("windows")

    Facter::Util::IP.stubs(:get_interfaces).returns ["Local Area Connection", "Loopback \"Pseudo-Interface\" (#1)"]
    Facter.fact(:interfaces).value.should == %{Local_Area_Connection,Loopback__Pseudo_Interface____1_}
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-1.7.1 spec/unit/interfaces_spec.rb
facter-1.7.1.rc1 spec/unit/interfaces_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/spec/unit/interfaces_spec.rb
facter-1.7.0 spec/unit/interfaces_spec.rb
facter-1.7.0.rc2 spec/unit/interfaces_spec.rb
facter-1.7.0.rc1 spec/unit/interfaces_spec.rb
facter-1.6.18 spec/unit/interfaces_spec.rb
facter-1.6.18.rc1 spec/unit/interfaces_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/spec/unit/interfaces_spec.rb
facter-1.6.17 spec/unit/interfaces_spec.rb
facter-1.6.17.rc1 spec/unit/interfaces_spec.rb
facter-1.6.16 spec/unit/interfaces_spec.rb
facter-1.6.15 spec/unit/interfaces_spec.rb
facter-1.6.15.rc1 spec/unit/interfaces_spec.rb
facter-1.6.14 spec/unit/interfaces_spec.rb
facter-1.6.14.rc1 spec/unit/interfaces_spec.rb