summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRein Henrichs <rein@puppetlabs.com>2010-08-18 15:50:39 -0700
committerRein Henrichs <rein@puppetlabs.com>2010-10-04 14:20:58 -0700
commit11544c16e514353f5fde5361a55cf04feb91fc64 (patch)
treea49bb8871cf8ed0d62cc5f9439d87c54fbdf0b63 /spec
parente6bfdf9bf7a0d929dc7d882d3ea3bcb7372b75e0 (diff)
downloadfacter-11544c16e514353f5fde5361a55cf04feb91fc64.tar.gz
facter-11544c16e514353f5fde5361a55cf04feb91fc64.tar.xz
facter-11544c16e514353f5fde5361a55cf04feb91fc64.zip
[#4289] operatingsystemrelease fact for oel, ovs
When Facter returns operatingsystem as "oel" or "ovs", the operatingsystemrelease fact does not catch these properly, causing an error. Specs added to catch failure and case statement updated to catch "oel" and "ovs" as well as "OEL" and "OVS"
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/operatingsystemrelease.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/unit/operatingsystemrelease.rb b/spec/unit/operatingsystemrelease.rb
new file mode 100644
index 0000000..31d4ae8
--- /dev/null
+++ b/spec/unit/operatingsystemrelease.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../spec_helper'
+
+require 'facter'
+
+describe "Operating System Release fact" do
+
+ before do
+ Facter.clear
+ end
+
+ after do
+ Facter.clear
+ end
+
+ test_cases = {
+ "CentOS" => "/etc/redhat-release",
+ "RedHat" => "/etc/redhat-release",
+ "Fedora" => "/etc/fedora-release",
+ "MeeGo" => "/etc/meego-release",
+ "OEL" => "/etc/enterprise-release",
+ "oel" => "/etc/enterprise-release",
+ "OVS" => "/etc/ovs-release",
+ "ovs" => "/etc/ovs-release"
+ }
+
+ test_cases.each do |system, file|
+ context "with operatingsystem reported as #{system.inspect}" do
+ it "should read the #{file.inspect} file" do
+ Facter.fact(:operatingsystem).stubs(:value).returns(system)
+
+ File.expects(:open).with(file, "r").at_least(1)
+
+ Facter.fact(:operatingsystemrelease).value
+ end
+ end
+ end
+end