summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-03-08 11:23:11 -0800
committerJacob Helwig <jacob@puppetlabs.com>2011-03-08 11:23:11 -0800
commit469d2a26a467c50af9f9732d7f98e8a01ecc369f (patch)
treecb5f4d7b64404105d7b43492d36437201cb13e08 /spec/unit
parent154d2a26a1cd81395c370a586a264f6ed13b0fb3 (diff)
parentfd38ce08cdcd8b3357400787089c34b1b61d4551 (diff)
downloadfacter-469d2a26a467c50af9f9732d7f98e8a01ecc369f.tar.gz
facter-469d2a26a467c50af9f9732d7f98e8a01ecc369f.tar.xz
facter-469d2a26a467c50af9f9732d7f98e8a01ecc369f.zip
Merge branch 'next'
* next: Fixed #5950 - Solaris ipaddress incorrect after bonding failure (#6615) fix missing stub calls in loader specs (#5666) windows support for facter/id.rb (#4925) - MS Windows doesn't do man pages Fixed #6611 - Fixed broken HPVM test and rationalised test structure (#6525) change semicolons to 'then' in case statement for ruby 1.9.2 compatibility Fixes #6521 and other Ruby 1.9 issues Fixed #6525 - Test failures on Ruby 1.9.x (#5031) Remove redundant puts from RDoc.usage
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/util/loader_spec.rb11
-rw-r--r--spec/unit/util/manufacturer_spec.rb4
-rw-r--r--spec/unit/virtual_spec.rb23
3 files changed, 19 insertions, 19 deletions
diff --git a/spec/unit/util/loader_spec.rb b/spec/unit/util/loader_spec.rb
index eed533a..90530e8 100755
--- a/spec/unit/util/loader_spec.rb
+++ b/spec/unit/util/loader_spec.rb
@@ -119,7 +119,10 @@ describe Facter::Util::Loader do
@loader.stubs(:search_path).returns %w{/one/dir}
Dir.stubs(:entries).with("/one/dir/testing").returns %w{foo.rb bar.rb}
- %w{/one/dir/testing/foo.rb /one/dir/testing/bar.rb}.each { |f| File.stubs(:directory?).with(f).returns false }
+ %w{/one/dir/testing/foo.rb /one/dir/testing/bar.rb}.each do |f|
+ File.stubs(:directory?).with(f).returns false
+ Kernel.stubs(:load).with(f)
+ end
@loader.load(:testing)
@loader.loaded_files.should == %w{/one/dir/testing/bar.rb /one/dir/testing/foo.rb}
@@ -202,7 +205,11 @@ describe Facter::Util::Loader do
Dir.stubs(:entries).with("/one/dir").returns %w{foo.rb bar.rb}
%w{/one/dir}.each { |f| File.stubs(:directory?).with(f).returns true }
- %w{/one/dir/foo.rb /one/dir/bar.rb}.each { |f| File.stubs(:directory?).with(f).returns false }
+
+ %w{/one/dir/foo.rb /one/dir/bar.rb}.each do |f|
+ File.stubs(:directory?).with(f).returns false
+ Kernel.expects(:load).with(f)
+ end
@loader.load_all
diff --git a/spec/unit/util/manufacturer_spec.rb b/spec/unit/util/manufacturer_spec.rb
index 07473db..c3b372e 100644
--- a/spec/unit/util/manufacturer_spec.rb
+++ b/spec/unit/util/manufacturer_spec.rb
@@ -109,8 +109,8 @@ Handle 0x001F
def find_product_name(os)
output_file = case os
- when "FreeBSD": File.dirname(__FILE__) + "/../data/freebsd_dmidecode"
- when "SunOS" : File.dirname(__FILE__) + "/../data/opensolaris_smbios"
+ when "FreeBSD" then File.dirname(__FILE__) + "/../data/freebsd_dmidecode"
+ when "SunOS" then File.dirname(__FILE__) + "/../data/opensolaris_smbios"
end
output = File.new(output_file).read()
diff --git a/spec/unit/virtual_spec.rb b/spec/unit/virtual_spec.rb
index a152b40..5f63dab 100644
--- a/spec/unit/virtual_spec.rb
+++ b/spec/unit/virtual_spec.rb
@@ -6,9 +6,14 @@ require 'facter/util/macosx'
describe "Virtual fact" do
- after do
- Facter.clear
- end
+ before do
+ Facter::Util::Virtual.stubs(:zone?).returns(false)
+ Facter::Util::Virtual.stubs(:openvz?).returns(false)
+ Facter::Util::Virtual.stubs(:vserver?).returns(false)
+ Facter::Util::Virtual.stubs(:xen?).returns(false)
+ Facter::Util::Virtual.stubs(:kvm?).returns(false)
+ Facter::Util::Virtual.stubs(:hpvm?).returns(false)
+ end
it "should be zone on Solaris when a zone" do
Facter.fact(:kernel).stubs(:value).returns("SunOS")
@@ -58,13 +63,6 @@ describe "Virtual fact" do
end
describe "on Linux" do
- before do
- Facter::Util::Virtual.stubs(:zone?).returns(false)
- Facter::Util::Virtual.stubs(:openvz?).returns(false)
- Facter::Util::Virtual.stubs(:vserver?).returns(false)
- Facter::Util::Virtual.stubs(:xen?).returns(false)
- Facter::Util::Virtual.stubs(:kvm?).returns(false)
- end
it "should be parallels with Parallels vendor id from lspci" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
@@ -114,15 +112,10 @@ describe "Virtual fact" do
Facter.fact(:virtual).value.should == "parallels"
end
end
-
end
describe "is_virtual fact" do
- after do
- Facter.clear
- end
-
it "should be virtual when running on xen" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter.fact(:virtual).stubs(:value).returns("xenu")