~gandelman-a/ubuntu/precise/facter/merge922788

« back to all changes in this revision

Viewing changes to spec/unit/interfaces_spec.rb

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-18 10:32:42 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111018103242-ag8i8vejfp8v7b1b
Tags: upstream-1.6.1
ImportĀ upstreamĀ versionĀ 1.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
4
4
 
5
5
require 'facter'
 
6
require 'facter/util/ip'
6
7
 
7
8
describe "Per Interface IP facts" do
8
 
    before do
9
 
        Facter.loadfacts
10
 
    end
11
 
 
12
9
    it "should replace the ':' in an interface list with '_'" do
13
10
        # So we look supported
14
11
        Facter.fact(:kernel).stubs(:value).returns("SunOS")
15
12
 
16
 
        Facter::Util::IP.expects(:get_interfaces).returns %w{eth0:1 eth1:2}
 
13
        Facter::Util::IP.stubs(:get_interfaces).returns %w{eth0:1 eth1:2}
17
14
        Facter.fact(:interfaces).value.should == %{eth0_1,eth1_2}
18
15
    end
 
16
 
 
17
  it "should replace non-alphanumerics in an interface list with '_'" do
 
18
    Facter.fact(:kernel).stubs(:value).returns("windows")
 
19
 
 
20
    Facter::Util::IP.stubs(:get_interfaces).returns ["Local Area Connection", "Loopback \"Pseudo-Interface\" (#1)"]
 
21
    Facter.fact(:interfaces).value.should == %{Local_Area_Connection,Loopback__Pseudo_Interface____1_}
 
22
  end
19
23
end