diff options
Diffstat (limited to 'spec/unit/util/autoload.rb')
-rwxr-xr-x | spec/unit/util/autoload.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/unit/util/autoload.rb b/spec/unit/util/autoload.rb index 53b90db69..3bd5b50ad 100755 --- a/spec/unit/util/autoload.rb +++ b/spec/unit/util/autoload.rb @@ -51,6 +51,10 @@ describe Puppet::Util::Autoload do end end + it "should include its FileCache module" do + Puppet::Util::Autoload.ancestors.should be_include(Puppet::Util::Autoload::FileCache) + end + describe "when loading a file" do before do @autoload.stubs(:searchpath).returns %w{/a} @@ -58,14 +62,20 @@ describe Puppet::Util::Autoload do [RuntimeError, LoadError, SyntaxError].each do |error| it "should not die an if a #{error.to_s} exception is thrown" do - FileTest.stubs(:directory?).returns true - FileTest.stubs(:exist?).returns true + @autoload.stubs(:file_exist?).returns true Kernel.expects(:load).raises error @autoload.load("foo") end end + + it "should skip files that it knows are missing" do + @autoload.expects(:missing_file?).returns true + @autoload.expects(:eachdir).never + + @autoload.load("foo") + end end describe "when loading all files" do |