diff options
| author | Markus Roberts <Markus@reality.com> | 2010-10-24 14:08:14 -0700 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-04-12 12:47:32 -0700 |
| commit | 10230cfc28e77dde127c157b7238fee2fc378969 (patch) | |
| tree | 2553d228a877ddc3b912bfb25bee9b8c70338878 /spec/unit/parser | |
| parent | e5609ffefb4132049a969d88f74138058fe78694 (diff) | |
| download | puppet-10230cfc28e77dde127c157b7238fee2fc378969.tar.gz puppet-10230cfc28e77dde127c157b7238fee2fc378969.tar.xz puppet-10230cfc28e77dde127c157b7238fee2fc378969.zip | |
Step towards #5027 -- scopes should know if they are dynamic
The logic for distinguishing dynamic / static scopes was borrowed from Nick &
Paul's patch, the main differences here being 1) calling it "dynamic" (true/
false) rather than "parent_relationship" (:inherited/:dynamic) 2) aligning the
default so that it only needs to get set in one place (the one that will
eventually go away) and 3) setting it on createion rather than with a setter.
Setting it in one place, on creation, also makes it easier to see that anytime
we access a scope it will have the correct setting of Scope#dynamic and that
this does not change.
This commit also contains a minor refactor (removing Type#subscope) that is not
strictly tied to the main purpose but lies in the direction we are needing to
go and it simplified things to do it now.
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/scope_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 17f485c03..8215535dd 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -73,6 +73,14 @@ describe Puppet::Parser::Scope do Puppet::Parser::Scope.new.singleton_class.ancestors.should be_include(mod) end + + it "should remember if it is dynamic" do + (!!Puppet::Parser::Scope.new(:dynamic => true).dynamic).should == true + end + + it "should assume it is not dynamic" do + (!Puppet::Parser::Scope.new.dynamic).should == true + end end describe "when looking up a variable" do |
