diff options
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/facter.rb | 25 | ||||
-rwxr-xr-x | spec/unit/util/loader.rb | 7 |
2 files changed, 32 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") { diff --git a/spec/unit/util/loader.rb b/spec/unit/util/loader.rb index 5e25ef5..b9b4306 100755 --- a/spec/unit/util/loader.rb +++ b/spec/unit/util/loader.rb @@ -51,6 +51,13 @@ describe Facter::Util::Loader do end end + it "should include all search paths registered with Facter" do + Facter.expects(:search_path).returns %w{/one /two} + paths = @loader.search_path + paths.should be_include("/one") + paths.should be_include("/two") + end + describe "and the FACTERLIB environment variable is set" do it "should include all paths in FACTERLIB" do with_env "FACTERLIB" => "/one/path:/two/path" do |