summaryrefslogtreecommitdiffstats
path: root/spec/unit/operatingsystem_spec.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-01-31 13:21:22 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-01-31 13:21:22 -0800
commitfa06a388cd3fd91b62d4e65bbe4ff74bcfe46ad0 (patch)
tree04369523bed9f9ce292ada8503e4183f0da84d31 /spec/unit/operatingsystem_spec.rb
parente717fed872f68c52fc0193bab2095a12f03433ac (diff)
parentd9b8f2ad68626b8655d98a8d9037283f671f86bb (diff)
downloadfacter-fa06a388cd3fd91b62d4e65bbe4ff74bcfe46ad0.tar.gz
facter-fa06a388cd3fd91b62d4e65bbe4ff74bcfe46ad0.tar.xz
facter-fa06a388cd3fd91b62d4e65bbe4ff74bcfe46ad0.zip
Merge commit 'd9b8f2a'
Diffstat (limited to 'spec/unit/operatingsystem_spec.rb')
-rwxr-xr-xspec/unit/operatingsystem_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/unit/operatingsystem_spec.rb b/spec/unit/operatingsystem_spec.rb
new file mode 100755
index 0000000..be83916
--- /dev/null
+++ b/spec/unit/operatingsystem_spec.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+require 'facter'
+
+describe "Operating System fact" do
+
+ before do
+ Facter.clear
+ end
+
+ 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