diff options
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/functions/defined.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/scope.rb | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/spec/unit/parser/functions/defined.rb b/spec/unit/parser/functions/defined.rb index 0da8c4a31..03b0ef9dd 100755 --- a/spec/unit/parser/functions/defined.rb +++ b/spec/unit/parser/functions/defined.rb @@ -5,9 +5,9 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the 'defined' function" do before :each do - @scope = Puppet::Parser::Scope.new() + Puppet::Node::Environment.stubs(:current).returns(nil) @compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo")) - @scope.compiler = @compiler + @scope = Puppet::Parser::Scope.new(:compiler => @compiler) end it "should exist" do diff --git a/spec/unit/parser/scope.rb b/spec/unit/parser/scope.rb index 7093279b6..b14b2d3b6 100755 --- a/spec/unit/parser/scope.rb +++ b/spec/unit/parser/scope.rb @@ -59,10 +59,12 @@ describe Puppet::Parser::Scope do end describe "when initializing" do - it "should extend itself with its environment's Functions module" do + it "should extend itself with its environment's Functions module as well as the default" do env = Puppet::Node::Environment.new("myenv") compiler = stub 'compiler', :environment => env - mod = Module.new + mod = Module.new + root_mod = Module.new + Puppet::Parser::Functions.expects(:environment_module).with(Puppet::Node::Environment.root).returns root_mod Puppet::Parser::Functions.expects(:environment_module).with(env).returns mod Puppet::Parser::Scope.new(:compiler => compiler).metaclass.ancestors.should be_include(mod) @@ -70,7 +72,7 @@ describe Puppet::Parser::Scope do it "should extend itself with the default Functions module if it has no environment" do mod = Module.new - Puppet::Parser::Functions.expects(:environment_module).with(nil).returns mod + Puppet::Parser::Functions.expects(:environment_module).with(Puppet::Node::Environment.root).returns(mod) Puppet::Parser::Scope.new().metaclass.ancestors.should be_include(mod) end |
