diff options
author | Luke Kanies <luke@madstop.com> | 2009-08-31 16:01:17 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-09-01 21:04:06 +1000 |
commit | d397f8d1d1092067f7ca52449ce9af63f02f44e1 (patch) | |
tree | f7ec36c5e05bd55b8e21fce565f493a85e2f65a0 /spec/integration/util/autoload.rb | |
parent | 800a78b993f15e2d77312bf207929ec876e9b227 (diff) | |
download | puppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.tar.gz puppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.tar.xz puppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.zip |
Fixing #2574 - autoloading finds plugins in modules
We had some stupid errors that were preventing this
from happening; this fixes them and adds an
integration test.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration/util/autoload.rb')
-rwxr-xr-x | spec/integration/util/autoload.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/integration/util/autoload.rb b/spec/integration/util/autoload.rb index f84c00bcb..a1c8aaa58 100755 --- a/spec/integration/util/autoload.rb +++ b/spec/integration/util/autoload.rb @@ -3,6 +3,7 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } require 'puppet/util/autoload' +require 'fileutils' class AutoloadIntegrator @things = [] @@ -93,4 +94,21 @@ describe Puppet::Util::Autoload do } } end + + it "should be able to load files directly from modules" do + modulepath = tmpfile("autoload_module_testing") + libdir = File.join(modulepath, "mymod", "lib", "foo") + FileUtils.mkdir_p(libdir) + + file = File.join(libdir, "plugin.rb") + + Puppet[:modulepath] = modulepath + + with_loader("foo", "foo") do |dir, loader| + with_file(:plugin, file.split("/")) do + loader.load(:plugin) + loader.should be_loaded("plugin.rb") + end + end + end end |