diff options
author | Luke Kanies <luke@madstop.com> | 2009-06-16 13:25:07 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-07-16 21:23:03 +1000 |
commit | eb40966777beaff2ceca8b91e10e3cb0132ec218 (patch) | |
tree | 006e5f960ee4da5391672b972aa8ab5e5d9a4825 /spec/unit/util/autoload.rb | |
parent | a42e8788b1fde5273ba1e34f6d90c451394849b8 (diff) | |
download | puppet-eb40966777beaff2ceca8b91e10e3cb0132ec218.tar.gz puppet-eb40966777beaff2ceca8b91e10e3cb0132ec218.tar.xz puppet-eb40966777beaff2ceca8b91e10e3cb0132ec218.zip |
Ruby no longer clobbers puppet autoloading
We basically just make sure that we tell Ruby
about files we've loaded, so you can 'require' these
files and doing so will essentially no-op, rather
than clobbering the already-loaded code.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/util/autoload.rb')
-rwxr-xr-x | spec/unit/util/autoload.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/unit/util/autoload.rb b/spec/unit/util/autoload.rb index d05bc15f0..c4a8642a0 100755 --- a/spec/unit/util/autoload.rb +++ b/spec/unit/util/autoload.rb @@ -82,12 +82,21 @@ describe Puppet::Util::Autoload do @autoload.should be_named_file_missing("foo") end + + it "should register loaded files with the main loaded file list so they are not reloaded by ruby" do + @autoload.stubs(:file_exist?).returns true + Kernel.stubs(:load) + + @autoload.load("myfile") + + $".should be_include("tmp/myfile.rb") + end end describe "when loading all files" do before do @autoload.stubs(:searchpath).returns %w{/a} - Dir.stubs(:glob).returns "file.rb" + Dir.stubs(:glob).returns "/path/to/file.rb" end [RuntimeError, LoadError, SyntaxError].each do |error| @@ -97,5 +106,11 @@ describe Puppet::Util::Autoload do lambda { @autoload.loadall }.should_not raise_error end end + + it "should require the full path to the file" do + Kernel.expects(:require).with("/path/to/file.rb") + + @autoload.loadall + end end end |