diff options
| author | Luke Kanies <luke@madstop.com> | 2009-05-14 11:36:20 -0500 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-05-15 10:01:26 +1000 |
| commit | fb957ccb6636ce86bd98c141d5818c54bc0d4659 (patch) | |
| tree | 4ee5fd0ddc1e09dbb72bc06e6fcfd0caeee04f38 /spec/unit/node | |
| parent | c6084093e67b1e415e49c192b3ac6f6b9aebc4ba (diff) | |
| download | puppet-fb957ccb6636ce86bd98c141d5818c54bc0d4659.tar.gz puppet-fb957ccb6636ce86bd98c141d5818c54bc0d4659.tar.xz puppet-fb957ccb6636ce86bd98c141d5818c54bc0d4659.zip | |
Modules now can find their own paths
Previously, when you created a module you had to specify
the path. Now Module instances can use the module path
to look up their paths, and there are methods for determining
whether the module is present (if the path is present).
Also cleaned up the methods for figuring out what's in
the module (plugins, etc.).
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/environment.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/spec/unit/node/environment.rb b/spec/unit/node/environment.rb index dd6745f1e..5fac98b77 100755 --- a/spec/unit/node/environment.rb +++ b/spec/unit/node/environment.rb @@ -94,28 +94,24 @@ describe Puppet::Node::Environment do env.modules.should == %w{mod1 mod2} end - it "should be able to return an individual module by matching the module name" do + it "should be able to return an individual module that exists in its module path" do env = Puppet::Node::Environment.new("testing") - module_path = %w{/one /two}.join(File::PATH_SEPARATOR) - env.expects(:modulepath).returns module_path - one = stub 'one', :name => 'one' - two = stub 'two', :name => 'two' - Puppet::Module.expects(:each_module).with(module_path).multiple_yields(one, two) + mod = mock 'module' + Puppet::Module.expects(:new).with("one", env).returns mod + mod.expects(:exist?).returns true - env.module("two").should equal(two) + env.module("one").should equal(mod) end - it "should return nil if asked for a module that is not in its path" do + it "should return nil if asked for a module that does not exist in its path" do env = Puppet::Node::Environment.new("testing") - module_path = %w{/one /two}.join(File::PATH_SEPARATOR) - env.expects(:modulepath).returns module_path - one = stub 'one', :name => 'one' - two = stub 'two', :name => 'two' - Puppet::Module.expects(:each_module).with(module_path).multiple_yields(one, two) + mod = mock 'module' + Puppet::Module.expects(:new).with("one", env).returns mod + mod.expects(:exist?).returns false - env.module("three").should be_nil + env.module("one").should be_nil end end end |
