Sha256: c7cb0b43031dd4e9b23597c1b1322d7f2d1e1b2eeace68e3b6714f855f5f432f
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
#!/usr/bin/env ruby $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppettest' class TestModules < Test::Unit::TestCase include PuppetTest def setup super @varmods = File::join(Puppet[:vardir], "modules") FileUtils::mkdir_p(@varmods) end def test_modulepath Puppet[:modulepath] = "$vardir/modules:/no/such/path/anywhere:.::" assert_equal([ @varmods ], Puppet::Module.modulepath) end def test_find assert_nil(Puppet::Module::find("/tmp")) file = "testmod/something" assert_nil(Puppet::Module::find(file)) path = File::join(@varmods, "testmod") FileUtils::mkdir_p(path) mod = Puppet::Module::find("testmod") assert_not_nil(mod) assert_equal("testmod", mod.name) assert_equal(path, mod.path) mod = Puppet::Module::find(file) assert_not_nil(mod) assert_equal("testmod", mod.name) assert_equal(path, mod.path) end def test_find_template templ = "testmod/templ.erb" assert_equal(File::join(Puppet[:templatedir], templ), Puppet::Module::find_template(templ)) templ_path = File::join(@varmods, "testmod", Puppet::Module::TEMPLATES, "templ.erb") FileUtils::mkdir_p(File::dirname(templ_path)) File::open(templ_path, "w") { |f| f.puts "Howdy" } assert_equal(templ_path, Puppet::Module::find_template(templ)) mod = Puppet::Module::find(templ) assert_not_nil(mod) assert_equal(templ_path, mod.template(templ)) end end # $Id: modules.rb 2655 2007-07-06 22:22:10Z luke $
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-0.23.1 | test/puppet/modules.rb |
puppet-0.23.2 | test/puppet/modules.rb |