summaryrefslogtreecommitdiffstats
path: root/test/util/autoload.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-16 00:00:47 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-16 00:00:47 +0000
commite95734b8bbe570381f4da078b3977a905fe6e031 (patch)
tree1e8cfa0524a70ac5cc9fc833b90a0e2a6aa78734 /test/util/autoload.rb
parentdbedcd7b9892bc41728a4f334464f152d09d54fc (diff)
downloadpuppet-e95734b8bbe570381f4da078b3977a905fe6e031.tar.gz
puppet-e95734b8bbe570381f4da078b3977a905fe6e031.tar.xz
puppet-e95734b8bbe570381f4da078b3977a905fe6e031.zip
Redoing autoload a bit in preparation for adding a plugindir
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2518 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/util/autoload.rb')
-rwxr-xr-xtest/util/autoload.rb27
1 files changed, 6 insertions, 21 deletions
diff --git a/test/util/autoload.rb b/test/util/autoload.rb
index 34f40df24..4be6b3930 100755
--- a/test/util/autoload.rb
+++ b/test/util/autoload.rb
@@ -74,7 +74,7 @@ TestAutoload.newthing(:#{name.to_s})
# Now try to actually load it.
assert_nothing_raised {
assert_equal(true, loader.load(:mything),
- "got incorrect return on failed load")
+ "got incorrect return on load")
}
assert(loader.loaded?(:mything), "Not considered loaded")
@@ -103,28 +103,13 @@ TestAutoload.newthing(:#{name.to_s})
# Make sure that autoload dynamically modifies $: with the libdir as
# appropriate.
- def test_autoload_uses_libdir
+ def test_searchpath
dir = Puppet[:libdir]
- unless FileTest.directory?(dir)
- Dir.mkdir(dir)
- end
-
- loader = File.join(dir, "test")
- Dir.mkdir(loader)
- name = "funtest"
- file = File.join(loader, "funtest.rb")
- File.open(file, "w") do |f|
- f.puts "$loaded = true"
- end
- auto = Puppet::Util::Autoload.new(self, "test")
+ loader = Puppet::Util::Autoload.new(self, "testing")
- # Now make sure autoloading modifies $: as necessary
- assert(! $:.include?(dir), "search path already includes libdir")
-
- assert_nothing_raised do
- assert(auto.load("funtest"), "did not successfully load funtest")
- end
- assert($:.include?(dir), "libdir did not get added to search path")
+ assert(loader.send(:searchpath).include?(dir), "searchpath does not include the libdir")
end
end
+
+# $Id$