diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-05-22 17:58:44 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 2a73b5d194a5237722840844588a03addedf2d4c (patch) | |
tree | 6a65357dfb01f961d07791edd486af15686c0133 /spec/unit/util/autoload.rb | |
parent | 7952af5b80331f60d9f3703e63285fc7fb733a8c (diff) | |
download | puppet-2a73b5d194a5237722840844588a03addedf2d4c.tar.gz puppet-2a73b5d194a5237722840844588a03addedf2d4c.tar.xz puppet-2a73b5d194a5237722840844588a03addedf2d4c.zip |
[#3674] Part 2: Autoloader load method should propagate failures
Change Autoloader's load to re-raise exceptions that happen when
trying to load files, rather than just warning.
This version still does not raise an error if the file is not found, as
doing so would change the behavior of 'load' pretty significantly, but I
am ambivalent this.
Diffstat (limited to 'spec/unit/util/autoload.rb')
-rwxr-xr-x | spec/unit/util/autoload.rb | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/spec/unit/util/autoload.rb b/spec/unit/util/autoload.rb index 1b8866246..0f73a73d7 100755 --- a/spec/unit/util/autoload.rb +++ b/spec/unit/util/autoload.rb @@ -72,26 +72,17 @@ describe Puppet::Util::Autoload do end [RuntimeError, LoadError, SyntaxError].each do |error| - it "should not die an if a #{error.to_s} exception is thrown" do + it "should die with Puppet::Error if a #{error.to_s} exception is thrown" do @autoload.stubs(:file_exist?).returns true Kernel.expects(:load).raises error - @autoload.load("foo") + lambda { @autoload.load("foo") }.should raise_error(Puppet::Error) end end - it "should skip files that it knows are missing" do - @autoload.expects(:named_file_missing?).with("foo").returns true - @autoload.expects(:eachdir).never - - @autoload.load("foo") - end - - it "should register that files are missing if they cannot be found" do - @autoload.load("foo") - - @autoload.should be_named_file_missing("foo") + it "should not raise an error if the file is missing" do + @autoload.load("foo").should == false end it "should register loaded files with the main loaded file list so they are not reloaded by ruby" do |