diff options
author | Luke Kanies <luke@madstop.com> | 2007-10-04 00:02:24 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-10-04 00:02:24 -0500 |
commit | bd8e38236a23ae687c418fcbb90e5f61c8c67b01 (patch) | |
tree | 4098acdd5e2a3d17c3b3e05c2c3df13f658d5f5e /test/util/autoload.rb | |
parent | 938f051256f206e01039d2c5142b2328fc25e639 (diff) | |
parent | 35718437c40ab4228bd58eabf89728b7d0919e50 (diff) | |
download | puppet-bd8e38236a23ae687c418fcbb90e5f61c8c67b01.tar.gz puppet-bd8e38236a23ae687c418fcbb90e5f61c8c67b01.tar.xz puppet-bd8e38236a23ae687c418fcbb90e5f61c8c67b01.zip |
Merge branch 'master' of ssh://reductivelabs.com/opt/rl/git/puppet
Diffstat (limited to 'test/util/autoload.rb')
-rwxr-xr-x | test/util/autoload.rb | 21 |
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 |