summaryrefslogtreecommitdiffstats
path: root/spec/unit/node/environment_spec.rb
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-08-13 15:43:34 -0700
committerPaul Berry <paul@puppetlabs.com>2010-08-13 15:54:26 -0700
commit4da88fb4cd57871f16649d50572240ac3f7420f0 (patch)
tree1b0df4e444bc27f925aac293cf721fa7acee06f7 /spec/unit/node/environment_spec.rb
parentcaca187dffbd6e628d7eda599c7f2939dd05fafc (diff)
downloadpuppet-4da88fb4cd57871f16649d50572240ac3f7420f0.tar.gz
puppet-4da88fb4cd57871f16649d50572240ac3f7420f0.tar.xz
puppet-4da88fb4cd57871f16649d50572240ac3f7420f0.zip
[#4496]+[#4521]+[#4522] Add structures to the AST to represent type definitions (classes, definitions, and nodes).
Previously, type definitions were not represented directly in the AST. Instead, the parser would instantiate types and insert them into known_resource_types as soon as they were parsed. This made it difficult to distinguish which types had come from the file that was just parsed and which types had been loaded previously, which led to bug 4496. A side-effect of this change is that the user is no longer allowed to define types inside of conditional constructs (such as if/else). This was allowed before but had unexpected semantics (bugs 4521 and 4522). It is still possible, however, to place an "include" statement inside a conditional construct, and have that "include" statement trigger the autoloading of a file that instantiates types.
Diffstat (limited to 'spec/unit/node/environment_spec.rb')
-rwxr-xr-xspec/unit/node/environment_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb
index e495d30a6..be2980879 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -52,7 +52,7 @@ describe Puppet::Node::Environment do
before do
@env = Puppet::Node::Environment.new("dev")
@collection = Puppet::Resource::TypeCollection.new(@env)
- @env.stubs(:perform_initial_import)
+ @env.stubs(:perform_initial_import).returns(Puppet::Parser::AST::Hostclass.new(''))
Thread.current[:known_resource_types] = nil
end
@@ -67,7 +67,7 @@ describe Puppet::Node::Environment do
it "should perform the initial import when creating a new collection" do
@env = Puppet::Node::Environment.new("dev")
- @env.expects(:perform_initial_import)
+ @env.expects(:perform_initial_import).returns(Puppet::Parser::AST::Hostclass.new(''))
@env.known_resource_types
end