diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-03-22 17:30:40 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2010-03-22 17:30:40 -0700 |
| commit | f891ba29ffeafb5ded6fdd26ef7a5bcde219f76a (patch) | |
| tree | 94426019095f051f6b49b2c4364d65aa964bc7cb /spec | |
| parent | af9c19ab7fa61cc4ed423d69f76bdce5b469d237 (diff) | |
| download | puppet-f891ba29ffeafb5ded6fdd26ef7a5bcde219f76a.tar.gz puppet-f891ba29ffeafb5ded6fdd26ef7a5bcde219f76a.tar.xz puppet-f891ba29ffeafb5ded6fdd26ef7a5bcde219f76a.zip | |
Fixing #3407 Failing tests in spec/unit/node/environment.rb
A naked rescue in Puppet::Node::Environment was hiding expectation
violations from the Mocha mocks.
Specifically, 'modulepath' expectations were failing, as Puppet::Module now calls
Puppet::Node::Environment#modulepath internally.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/node/environment.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/unit/node/environment.rb b/spec/unit/node/environment.rb index 21c224f23..b9bfcafc8 100755 --- a/spec/unit/node/environment.rb +++ b/spec/unit/node/environment.rb @@ -139,7 +139,7 @@ describe Puppet::Node::Environment do describe ".modules" do it "should return a module named for every directory in each module path" do env = Puppet::Node::Environment.new("testing") - env.expects(:modulepath).returns %w{/a /b} + env.expects(:modulepath).at_least_once.returns %w{/a /b} Dir.expects(:entries).with("/a").returns %w{foo bar} Dir.expects(:entries).with("/b").returns %w{bee baz} @@ -148,7 +148,7 @@ describe Puppet::Node::Environment do it "should remove duplicates" do env = Puppet::Node::Environment.new("testing") - env.expects(:modulepath).returns %w{/a /b} + env.expects(:modulepath).returns( %w{/a /b} ).at_least_once Dir.expects(:entries).with("/a").returns %w{foo} Dir.expects(:entries).with("/b").returns %w{foo} @@ -157,18 +157,18 @@ describe Puppet::Node::Environment do it "should ignore invalid modules" do env = Puppet::Node::Environment.new("testing") - env.expects(:modulepath).returns %w{/a} + env.expects(:modulepath).returns( %w{/a} ) Dir.expects(:entries).with("/a").returns %w{foo bar} Puppet::Module.expects(:new).with { |name, env| name == "foo" }.returns mock("foomod", :name => "foo") - Puppet::Module.expects(:new).with { |name, env| name == "bar" }.raises Puppet::Module::InvalidName + Puppet::Module.expects(:new).with { |name, env| name == "bar" }.raises( Puppet::Module::InvalidName, "name is invalid" ) env.modules.collect{|mod| mod.name}.sort.should == %w{foo} end it "should create modules with the correct environment" do env = Puppet::Node::Environment.new("testing") - env.expects(:modulepath).returns %w{/a} + env.expects(:modulepath).at_least_once.returns %w{/a} Dir.expects(:entries).with("/a").returns %w{foo} env.modules.each {|mod| mod.environment.should == env } @@ -176,7 +176,7 @@ describe Puppet::Node::Environment do it "should cache the module list" do env = Puppet::Node::Environment.new("testing") - env.expects(:modulepath).once.returns %w{/a} + env.expects(:modulepath).at_least_once.returns %w{/a} Dir.expects(:entries).once.with("/a").returns %w{foo} env.modules |
