summaryrefslogtreecommitdiffstats
path: root/test/util/autoload.rb
diff options
context:
space:
mode:
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