summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
committerNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
commit97927e321d1e24554ad21b92ef4afb1bd64c0167 (patch)
treedf2f82066114918911670749887812674e4a72e1 /spec
parent59173268a5c6525a4a5df55b362775d07bc6b52d (diff)
parent9404a7a3bb8da660e26897d052cdd03c291fb0bb (diff)
downloadfacter-master.tar.gz
facter-master.tar.xz
facter-master.zip
Merge branch 'ticket/master/7670'HEADmaster
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb1
-rwxr-xr-xspec/unit/interfaces_spec.rb7
-rw-r--r--spec/unit/memory_spec.rb4
-rwxr-xr-xspec/unit/operatingsystem_spec.rb2
-rwxr-xr-xspec/unit/util/loader_spec.rb4
5 files changed, 12 insertions, 6 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 28e7b72..483d4dc 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -18,6 +18,7 @@ RSpec.configure do |config|
# Ensure that we don't accidentally cache between test cases.
config.before :each do
+ Facter::Util::Loader.any_instance.stubs(:load_all)
Facter.clear
end
end
diff --git a/spec/unit/interfaces_spec.rb b/spec/unit/interfaces_spec.rb
index 8b295d6..cfe4226 100755
--- a/spec/unit/interfaces_spec.rb
+++ b/spec/unit/interfaces_spec.rb
@@ -3,17 +3,14 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'facter'
+require 'facter/util/ip'
describe "Per Interface IP facts" do
- before do
- Facter.loadfacts
- end
-
it "should replace the ':' in an interface list with '_'" do
# So we look supported
Facter.fact(:kernel).stubs(:value).returns("SunOS")
- Facter::Util::IP.expects(:get_interfaces).returns %w{eth0:1 eth1:2}
+ Facter::Util::IP.stubs(:get_interfaces).returns %w{eth0:1 eth1:2}
Facter.fact(:interfaces).value.should == %{eth0_1,eth1_2}
end
end
diff --git a/spec/unit/memory_spec.rb b/spec/unit/memory_spec.rb
index 5cae8cb..fe4ec36 100644
--- a/spec/unit/memory_spec.rb
+++ b/spec/unit/memory_spec.rb
@@ -6,7 +6,9 @@ require 'facter'
describe "Memory facts" do
before do
- Facter.loadfacts
+ # We need these facts loaded, but they belong to a file with a
+ # different name, so load the file explicitly.
+ Facter.collection.loader.load(:memory)
end
after do
diff --git a/spec/unit/operatingsystem_spec.rb b/spec/unit/operatingsystem_spec.rb
index 91cd311..9a7971d 100755
--- a/spec/unit/operatingsystem_spec.rb
+++ b/spec/unit/operatingsystem_spec.rb
@@ -34,6 +34,7 @@ describe "Operating System fact" do
it "should identify Oracle VM as OVS" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
+ Facter.stubs(:value).with(:lsbdistid).returns(nil)
FileTest.stubs(:exists?).returns false
FileTest.expects(:exists?).with("/etc/ovs-release").returns true
@@ -44,6 +45,7 @@ describe "Operating System fact" do
it "should identify VMWare ESX" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
+ Facter.stubs(:value).with(:lsbdistid).returns(nil)
FileTest.stubs(:exists?).returns false
FileTest.expects(:exists?).with("/etc/vmware-release").returns true
diff --git a/spec/unit/util/loader_spec.rb b/spec/unit/util/loader_spec.rb
index 90530e8..1bc909f 100755
--- a/spec/unit/util/loader_spec.rb
+++ b/spec/unit/util/loader_spec.rb
@@ -19,6 +19,10 @@ end
describe Facter::Util::Loader do
+ before :each do
+ Facter::Util::Loader.any_instance.unstub(:load_all)
+ end
+
def with_env(values)
old = {}
values.each do |var, value|