summaryrefslogtreecommitdiffstats
path: root/spec/unit/facter.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-05-16 10:38:15 -0500
committerLuke Kanies <luke@madstop.com>2008-05-16 10:38:15 -0500
commitbb41db0bf4221e394411d2a82b6de264b557fb95 (patch)
treefbc8773d5e6b5a708db24e3943ca3b3fb7f98880 /spec/unit/facter.rb
parent07a3d479b0e31aa7a1f8e6d0e178e440adc57030 (diff)
downloadfacter-bb41db0bf4221e394411d2a82b6de264b557fb95.tar.gz
facter-bb41db0bf4221e394411d2a82b6de264b557fb95.tar.xz
facter-bb41db0bf4221e394411d2a82b6de264b557fb95.zip
Switching to a search path registration system.
Facter no longer knows anything about Puppet, so there's no inter-dependency issue.
Diffstat (limited to 'spec/unit/facter.rb')
-rwxr-xr-xspec/unit/facter.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/facter.rb b/spec/unit/facter.rb
index 59d10d4..18611aa 100755
--- a/spec/unit/facter.rb
+++ b/spec/unit/facter.rb
@@ -107,6 +107,31 @@ describe Facter do
Facter.value(:macaddress).should_not be_include(" ")
end
+ it "should have a method for registering directories to search" do
+ Facter.should respond_to(:search)
+ end
+
+ it "should have a method for returning the registered search directories" do
+ Facter.should respond_to(:search_path)
+ end
+
+ describe "when registering directories to search" do
+ after { Facter.instance_variable_set("@search_path", []) }
+
+ it "should allow registration of a directory" do
+ Facter.search "/my/dir"
+ end
+
+ it "should allow registration of multiple directories" do
+ Facter.search "/my/dir", "/other/dir"
+ end
+
+ it "should return all registered directories when asked" do
+ Facter.search "/my/dir", "/other/dir"
+ Facter.search_path.should == %w{/my/dir /other/dir}
+ end
+ end
+
def test_onetrueconfine
assert_nothing_raised {
Facter.add("required") {