Sha256: a4f301b923914c37df0698e78cd03f4c14e19b65e1a25715a0c28ec24ae5319c

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../spec_helper'

require 'facter'

describe "Operating System fact" do
    
    
    after do
        Facter.clear
    end
    
    it "should default to the kernel name" do
        Facter.fact(:kernel).stubs(:value).returns("Nutmeg")

        Facter.fact(:operatingsystem).value.should == "Nutmeg"
    end
    
    it "should be Solaris for SunOS" do
         Facter.fact(:kernel).stubs(:value).returns("SunOS")
         
         Facter.fact(:operatingsystem).value.should == "Solaris"
    end
    
    it "should identify Oracle VM as OVS" do

        Facter.fact(:kernel).stubs(:value).returns("Linux")
        FileTest.stubs(:exists?).returns false

        FileTest.expects(:exists?).with("/etc/ovs-release").returns true
        FileTest.expects(:exists?).with("/etc/enterprise-release").returns true
        
        Facter.fact(:operatingsystem).value.should == "OVS"
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-1.5.6 spec/unit/operatingsystem.rb
facter-1.5.5 spec/unit/operatingsystem.rb