summaryrefslogtreecommitdiffstats
path: root/test/util/autoload.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-05 00:08:15 -0500
committerLuke Kanies <luke@madstop.com>2007-10-05 00:08:15 -0500
commit275af562b462813ddf5ddbad2192ddc2bf57770c (patch)
treeaceabf68095b8c34fd599f245022a9aaab0984da /test/util/autoload.rb
parentce0178316d8cefd072f53d39b59ce47332f6ec8f (diff)
parent29accba1b9343f4967c15d36506b3bf60d5f0f9c (diff)
downloadpuppet-275af562b462813ddf5ddbad2192ddc2bf57770c.tar.gz
puppet-275af562b462813ddf5ddbad2192ddc2bf57770c.tar.xz
puppet-275af562b462813ddf5ddbad2192ddc2bf57770c.zip
Merge branch 'routing' of http://git.rickbradley.com/puppet into routing
Diffstat (limited to 'test/util/autoload.rb')
-rwxr-xr-xtest/util/autoload.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/util/autoload.rb b/test/util/autoload.rb
index bae6d37d4..ca77572c2 100755
--- a/test/util/autoload.rb
+++ b/test/util/autoload.rb
@@ -102,4 +102,25 @@ TestAutoload.newthing(:#{name.to_s})
assert(loader.send(:searchpath).include?(dir), "searchpath does not include the libdir")
end
+
+ # This causes very strange behaviour in the tests. We need to make sure we
+ # require the same path that a user would use, otherwise we'll result in
+ # a reload of the
+ def test_require_does_not_cause_reload
+ loadname = "testing"
+ loader = Puppet::Util::Autoload.new(self.class, loadname)
+
+ basedir = "/some/dir"
+ dir = File.join(basedir, loadname)
+ loader.expects(:eachdir).yields(dir)
+
+ subname = "instance"
+
+ file = File.join(dir, subname) + ".rb"
+
+ Dir.expects(:glob).with("#{dir}/*.rb").returns(file)
+
+ Kernel.expects(:require).with(File.join(loadname, subname))
+ loader.loadall
+ end
end