summaryrefslogtreecommitdiffstats
path: root/test/util/autoload.rb
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-04 08:04:44 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-04 08:04:44 -0500
commit92d23e0398ffbaf7e264bb7ff716bd6f83130b07 (patch)
treeaf4a9296a11733c4636a88d38925804ea6f0793d /test/util/autoload.rb
parent1334b786ac622a6094ba68b3e66fce3f5841deed (diff)
parentbd8e38236a23ae687c418fcbb90e5f61c8c67b01 (diff)
downloadpuppet-92d23e0398ffbaf7e264bb7ff716bd6f83130b07.tar.gz
puppet-92d23e0398ffbaf7e264bb7ff716bd6f83130b07.tar.xz
puppet-92d23e0398ffbaf7e264bb7ff716bd6f83130b07.zip
Merge branch 'master' of git://reductivelabs.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