[Pkg-puppet-devel] [facter] 44/61: Maint: Don't output "No facts loaded from" during tests
Stig Sandbeck Mathisen
ssm at debian.org
Mon Nov 4 15:02:02 UTC 2013
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit c128221fabe36a5d3b1dd2cf23daea105bd20b7e
Author: Josh Cooper <josh at puppetlabs.com>
Date: Tue Jul 30 15:36:20 2013 -0700
Maint: Don't output "No facts loaded from" during tests
Previously, running `bundle exec rspec spec/unit/memory_spec.rb` would
output the warning "No facts loaded from ...". The reason was because
the memorytotal fact is defined in a file whose name doesn't match,
and the code that forces facter to load the memory facts was within an
inner describe block.
See #7670 and commit 2255abee7b for more information about facter's
quirky loading behavior.
This commit just moves the `load(:memory)` before each to the
outermost describe block. This ensures that all of the memory-derived
facts are "preloaded" so facter doesn't print a warning that it can't
find them.
---
spec/unit/memory_spec.rb | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/spec/unit/memory_spec.rb b/spec/unit/memory_spec.rb
index 1771a53..e79f8d3 100755
--- a/spec/unit/memory_spec.rb
+++ b/spec/unit/memory_spec.rb
@@ -3,15 +3,15 @@
require 'spec_helper'
describe "Memory facts" do
- after do
+ before(:each) do
+ Facter.collection.internal_loader.load(:memory)
+ end
+
+ after(:each) do
Facter.clear
end
describe "when returning scaled sizes" do
- before(:each) do
- Facter.collection.internal_loader.load(:memory)
- end
-
[ "memorysize",
"memoryfree",
"swapsize",
@@ -515,8 +515,8 @@ SWAP
end
it "should use the memorysize fact for the memorytotal fact" do
- Facter.fact("memorysize").expects(:value).once.returns "yay"
+ Facter.fact("memorysize").expects(:value).once.returns "16.00 GB"
Facter::Util::Resolution.expects(:exec).never
- Facter.fact("memorytotal").value.should == "yay"
+ Facter.fact(:memorytotal).value.should == "16.00 GB"
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list