[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:31:36 UTC 2010


The following commit has been merged in the upstream branch:
commit 201889bd30260698478d8469517299b290053189
Author: Luke Kanies <luke at reductivelabs.com>
Date:   Mon Jan 4 17:02:28 2010 -0800

    Renaming LoadedCode to ResourceTypeCollection
    
    Signed-off-by: Luke Kanies <luke at reductivelabs.com>

diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 77ee28f..6520900 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -3,7 +3,7 @@
 class Puppet::Parser::Parser
     require 'puppet/parser/functions'
     require 'puppet/parser/files'
-    require 'puppet/parser/loaded_code'
+    require 'puppet/parser/resource_type_collection'
     require 'puppet/parser/resource_type'
     require 'puppet/dsl'
     require 'monitor'
@@ -101,7 +101,7 @@ class Puppet::Parser::Parser
 
     [:hostclass, :definition, :node, :nodes?].each do |method|
         define_method(method) do |*args|
-            @loaded_code.send(method, *args)
+            @resource_type_collection.send(method, *args)
         end
     end
 
@@ -134,7 +134,7 @@ class Puppet::Parser::Parser
             names_to_try.compact!
         end
 
-        until (result = @loaded_code.send(method, namespace, name)) or names_to_try.empty? do
+        until (result = @resource_type_collection.send(method, namespace, name)) or names_to_try.empty? do
             self.load(names_to_try.shift)
         end
         return result
@@ -174,7 +174,7 @@ class Puppet::Parser::Parser
         end
 
         files.collect { |file|
-            parser = Puppet::Parser::Parser.new(:loaded_code => @loaded_code, :environment => @environment)
+            parser = Puppet::Parser::Parser.new(:resource_type_collection => @resource_type_collection, :environment => @environment)
             parser.files = self.files
             Puppet.debug("importing '%s'" % file)
 
@@ -195,7 +195,7 @@ class Puppet::Parser::Parser
 
     def initialize(options = {})
         @environment = options[:environment]
-        @loaded_code = options[:loaded_code] || Puppet::Parser::LoadedCode.new(@environment)
+        @resource_type_collection = options[:resource_type_collection] || Puppet::Parser::ResourceTypeCollection.new(@environment)
         initvars()
     end
 
@@ -252,7 +252,7 @@ class Puppet::Parser::Parser
         end
         # We don't know whether we're looking for a class or definition, so we have
         # to test for both.
-        return @loaded_code.hostclass(classname) || @loaded_code.definition(classname)
+        return @resource_type_collection.hostclass(classname) || @resource_type_collection.definition(classname)
     end
 
     # Try to load a class, since we could not find it.
@@ -277,12 +277,12 @@ class Puppet::Parser::Parser
 
     # Create a new class, or merge with an existing class.
     def newclass(name, options = {})
-        @loaded_code.add Puppet::Parser::ResourceType.new(:hostclass, name, ast_context(true).merge(options))
+        @resource_type_collection.add Puppet::Parser::ResourceType.new(:hostclass, name, ast_context(true).merge(options))
     end
 
     # Create a new definition.
     def newdefine(name, options = {})
-        @loaded_code.add Puppet::Parser::ResourceType.new(:definition, name, ast_context(true).merge(options))
+        @resource_type_collection.add Puppet::Parser::ResourceType.new(:definition, name, ast_context(true).merge(options))
     end
 
     # Create a new node.  Nodes are special, because they're stored in a global
@@ -291,7 +291,7 @@ class Puppet::Parser::Parser
         names = [names] unless names.instance_of?(Array)
         context = ast_context(true)
         names.collect do |name|
-            @loaded_code.add(Puppet::Parser::ResourceType.new(:node, name, context.merge(options)))
+            @resource_type_collection.add(Puppet::Parser::ResourceType.new(:node, name, context.merge(options)))
         end
     end
 
@@ -355,7 +355,7 @@ class Puppet::Parser::Parser
             # Store the results as the top-level class.
             newclass("", :code => main)
         end
-        return @loaded_code
+        return @resource_type_collection
     ensure
         @lexer.clear
     end
diff --git a/lib/puppet/parser/loaded_code.rb b/lib/puppet/parser/resource_type_collection.rb
similarity index 87%
rename from lib/puppet/parser/loaded_code.rb
rename to lib/puppet/parser/resource_type_collection.rb
index d7f179a..c6a9188 100644
--- a/lib/puppet/parser/loaded_code.rb
+++ b/lib/puppet/parser/resource_type_collection.rb
@@ -1,11 +1,27 @@
-class Puppet::Parser::LoadedCode
-    def initialize
+class Puppet::Parser::ResourceTypeCollection
+    attr_reader :environment
+
+    @code = {}
+
+    def self.[]=(environment, code)
+        @code[environment] = code
+    end
+
+    def self.[](environment)
+        @code[environment]
+    end
+
+    def initialize(environment)
+        @environment = environment
         @hostclasses = {}
         @definitions = {}
         @nodes = {}
 
         # So we can keep a list and match the first-defined regex
         @node_list = []
+
+        # Store the most recently created code collection globally per environment.
+        self.class[self.environment] = self
     end
 
     def <<(thing)
diff --git a/spec/integration/util/rdoc/parser.rb b/spec/integration/util/rdoc/parser.rb
index dcb9ae7..a52c11d 100755
--- a/spec/integration/util/rdoc/parser.rb
+++ b/spec/integration/util/rdoc/parser.rb
@@ -2,7 +2,7 @@
 
 Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
 
-require 'puppet/parser/loaded_code'
+require 'puppet/parser/resource_type_collection'
 require 'puppet/util/rdoc/parser'
 require 'puppet/util/rdoc'
 require 'puppet/util/rdoc/code_objects'
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index f10517f..16e469f 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -7,8 +7,8 @@ describe Puppet::Parser do
     ast = Puppet::Parser::AST
 
     before :each do
-        @loaded_code = Puppet::Parser::LoadedCode.new
-        @parser = Puppet::Parser::Parser.new :environment => "development", :loaded_code => @loaded_code
+        @resource_type_collection = Puppet::Parser::ResourceTypeCollection.new("development")
+        @parser = Puppet::Parser::Parser.new :environment => "development", :resource_type_collection => @resource_type_collection
         @true_ast = Puppet::Parser::AST::Boolean.new :value => true
     end
 
@@ -275,8 +275,8 @@ describe Puppet::Parser do
     end
 
     describe "when retrieving a specific node" do
-        it "should delegate to the loaded_code node" do
-            @loaded_code.expects(:node).with("node")
+        it "should delegate to the resource_type_collection node" do
+            @resource_type_collection.expects(:node).with("node")
 
             @parser.node("node")
         end
@@ -284,7 +284,7 @@ describe Puppet::Parser do
 
     describe "when retrieving a specific class" do
         it "should delegate to the loaded code" do
-            @loaded_code.expects(:hostclass).with("class")
+            @resource_type_collection.expects(:hostclass).with("class")
 
             @parser.hostclass("class")
         end
@@ -292,7 +292,7 @@ describe Puppet::Parser do
 
     describe "when retrieving a specific definitions" do
         it "should delegate to the loaded code" do
-            @loaded_code.expects(:definition).with("define")
+            @resource_type_collection.expects(:definition).with("define")
 
             @parser.definition("define")
         end
@@ -338,10 +338,10 @@ describe Puppet::Parser do
 
     describe "when looking up names" do
         before :each do
-            @loaded_code = mock 'loaded code'
-            @loaded_code.stubs(:find_my_type).with('loaded_namespace',  'loaded_name').returns(true)
-            @loaded_code.stubs(:find_my_type).with('bogus_namespace',   'bogus_name' ).returns(false)
-            @parser = Puppet::Parser::Parser.new :environment => "development",:loaded_code => @loaded_code
+            @resource_type_collection = mock 'loaded code'
+            @resource_type_collection.stubs(:find_my_type).with('loaded_namespace',  'loaded_name').returns(true)
+            @resource_type_collection.stubs(:find_my_type).with('bogus_namespace',   'bogus_name' ).returns(false)
+            @parser = Puppet::Parser::Parser.new :environment => "development",:resource_type_collection => @resource_type_collection
         end
 
         describe "that are already loaded" do
@@ -356,20 +356,20 @@ describe Puppet::Parser do
 
         describe "that aren't already loaded" do
             it "should first attempt to load them with the all lowercase fully qualified name" do
-                @loaded_code.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,true,true)
+                @resource_type_collection.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,true,true)
                 @parser.expects(:load).with("foo_namespace::foo_name").returns(true).then.raises(Exception)
                 @parser.find_or_load("Foo_namespace","Foo_name",:my_type).should == true
             end
 
             it "should next attempt to load them with the all lowercase namespace" do
-                @loaded_code.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,false,true,true)
+                @resource_type_collection.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,false,true,true)
                 @parser.expects(:load).with("foo_namespace::foo_name").returns(false).then.raises(Exception)
                 @parser.expects(:load).with("foo_namespace"          ).returns(true ).then.raises(Exception)
                 @parser.find_or_load("Foo_namespace","Foo_name",:my_type).should == true
             end
 
             it "should finally attempt to load them with the all lowercase unqualified name" do
-                @loaded_code.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,false,false,true,true)
+                @resource_type_collection.stubs(:find_my_type).with("foo_namespace","foo_name").returns(false,false,false,true,true)
                 @parser.expects(:load).with("foo_namespace::foo_name").returns(false).then.raises(Exception)
                 @parser.expects(:load).with("foo_namespace"          ).returns(false).then.raises(Exception)
                 @parser.expects(:load).with(               "foo_name").returns(true ).then.raises(Exception)
@@ -382,7 +382,7 @@ describe Puppet::Parser do
             end
 
             it "should directly look for fully qualified classes" do
-                @loaded_code.stubs(:find_hostclass).with("foo_namespace","::foo_name").returns(false, true)
+                @resource_type_collection.stubs(:find_hostclass).with("foo_namespace","::foo_name").returns(false, true)
                 @parser.expects(:load).with("foo_name").returns true
                 @parser.find_or_load("foo_namespace","::foo_name",:hostclass)
             end
@@ -391,8 +391,8 @@ describe Puppet::Parser do
 
     describe "when loading classnames" do
         before :each do
-            @loaded_code = mock 'loaded code'
-            @parser = Puppet::Parser::Parser.new :environment => "development",:loaded_code => @loaded_code
+            @resource_type_collection = mock 'loaded code'
+            @parser = Puppet::Parser::Parser.new :environment => "development",:resource_type_collection => @resource_type_collection
         end
 
         it "should just return false if the classname is empty" do
diff --git a/spec/unit/parser/resource_type.rb b/spec/unit/parser/resource_type.rb
index 08f7e2a..8a8bfb5 100755
--- a/spec/unit/parser/resource_type.rb
+++ b/spec/unit/parser/resource_type.rb
@@ -94,19 +94,19 @@ describe Puppet::Parser::ResourceType do
         end
 
         it "should return the name converted to a string when the name is not a regex" do
-            pending "Need to define LoadedCode behaviour first"
+            pending "Need to define ResourceTypeCollection behaviour first"
             name = Puppet::Parser::AST::HostName.new(:value => "foo")
             Puppet::Parser::ResourceType.new(:node, name).name.should == "foo"
         end
 
         it "should return the name converted to a string when the name is a regex" do
-            pending "Need to define LoadedCode behaviour first"
+            pending "Need to define ResourceTypeCollection behaviour first"
             name = Puppet::Parser::AST::HostName.new(:value => /regex/)
             Puppet::Parser::ResourceType.new(:node, name).name.should == /regex/.to_s
         end
 
         it "should mark any created scopes as a node scope" do
-            pending "Need to define LoadedCode behaviour first"
+            pending "Need to define ResourceTypeCollection behaviour first"
             name = Puppet::Parser::AST::HostName.new(:value => /regex/)
             Puppet::Parser::ResourceType.new(:node, name).name.should == /regex/.to_s
         end
diff --git a/spec/unit/parser/loaded_code.rb b/spec/unit/parser/resource_type_collection.rb
similarity index 76%
rename from spec/unit/parser/loaded_code.rb
rename to spec/unit/parser/resource_type_collection.rb
index 3a230f9..0d7795c 100644
--- a/spec/unit/parser/loaded_code.rb
+++ b/spec/unit/parser/resource_type_collection.rb
@@ -2,37 +2,37 @@
 
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-require 'puppet/parser/loaded_code'
+require 'puppet/parser/resource_type_collection'
 require 'puppet/parser/resource_type'
 
-describe Puppet::Parser::LoadedCode do
+describe Puppet::Parser::ResourceTypeCollection do
     before do
         @instance = Puppet::Parser::ResourceType.new(:hostclass, "foo")
-        @code = Puppet::Parser::LoadedCode.new("env")
+        @code = Puppet::Parser::ResourceTypeCollection.new("env")
     end
 
     it "should require an environment at initialization" do
-        Puppet::Parser::LoadedCode.new("foo").environment.should == "foo"
+        Puppet::Parser::ResourceTypeCollection.new("foo").environment.should == "foo"
     end
 
     it "should store itself as the environment-specific code collection in its class" do
-        code = Puppet::Parser::LoadedCode.new("foo")
-        Puppet::Parser::LoadedCode["foo"].should equal(code)
+        code = Puppet::Parser::ResourceTypeCollection.new("foo")
+        Puppet::Parser::ResourceTypeCollection["foo"].should equal(code)
     end
 
     it "should be able to add a resource type" do
-        Puppet::Parser::LoadedCode.new("env").should respond_to(:add)
+        Puppet::Parser::ResourceTypeCollection.new("env").should respond_to(:add)
     end
 
     it "should consider '<<' to be an alias to 'add' but should return self" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
         loader.expects(:add).with "foo"
         loader.expects(:add).with "bar"
         loader << "foo" << "bar"
     end
 
     it "should set itself as the code collection for added resource types" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
 
         node = Puppet::Parser::ResourceType.new(:node, "foo")
 
@@ -65,48 +65,48 @@ describe Puppet::Parser::LoadedCode do
 
     %w{hostclass node definition}.each do |data|
         it "should have a method for adding a #{data}" do
-            Puppet::Parser::LoadedCode.new("env").should respond_to("add_" + data)
+            Puppet::Parser::ResourceTypeCollection.new("env").should respond_to("add_" + data)
         end
 
         it "should use the name of the instance to add it" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             loader.send("add_#{data}", @instance)
             loader.send(data, @instance.name).should equal(@instance)
         end
 
         it "should fail to add a #{data} when one already exists" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             loader.add @instance
             lambda { loader.add(@instance) }.should raise_error(Puppet::ParseError)
         end
 
         it "should return the added #{data}" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
 
             loader.add(@instance).should equal(@instance)
         end
 
         it "should be able to retrieve #{data} by name" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(data, "bar")
             loader.add instance
             loader.send(data, "bar").should equal(instance)
         end
 
         it "should retrieve #{data} insensitive to case" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(data, "Bar")
             loader.add instance
             loader.send(data, "bAr").should equal(instance)
         end
 
         it "should return nil when asked for a #{data} that has not been added" do
-            Puppet::Parser::LoadedCode.new("env").send(data, "foo").should be_nil
+            Puppet::Parser::ResourceTypeCollection.new("env").send(data, "foo").should be_nil
         end
 
         it "should be able to retrieve all #{data}s" do
             plurals = { "hostclass" => "hostclasses", "node" => "nodes", "definition" => "definitions" }
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(data, "foo")
             loader.add instance
             loader.send(plurals[data]).should == { "foo" => instance }
@@ -115,54 +115,54 @@ describe Puppet::Parser::LoadedCode do
 
     describe "when finding a qualified instance" do
         it "should return any found instance if the instance name is fully qualified" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar")
             loader.add instance
             loader.find("namespace", "::foo::bar", :hostclass).should equal(instance)
         end
 
         it "should return nil if the instance name is fully qualified and no such instance exists" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             loader.find("namespace", "::foo::bar", :hostclass).should be_nil
         end
 
         it "should return the partially qualified object if it exists in the provided namespace" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar::baz")
             loader.add instance
             loader.find("foo", "bar::baz", :hostclass).should equal(instance)
         end
 
         it "should return the unqualified object if it exists in the provided namespace" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar")
             loader.add instance
             loader.find("foo", "bar", :hostclass).should equal(instance)
         end
 
         it "should return the unqualified object if it exists in the parent namespace" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar")
             loader.add instance
             loader.find("foo::bar::baz", "bar", :hostclass).should equal(instance)
         end
 
         it "should should return the partially qualified object if it exists in the parent namespace" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar::baz")
             loader.add instance
             loader.find("foo::bar", "bar::baz", :hostclass).should equal(instance)
         end
 
         it "should return the qualified object if it exists in the root namespace" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar::baz")
             loader.add instance
             loader.find("foo::bar", "foo::bar::baz", :hostclass).should equal(instance)
         end
 
         it "should return nil if the object cannot be found" do
-            loader = Puppet::Parser::LoadedCode.new("env")
+            loader = Puppet::Parser::ResourceTypeCollection.new("env")
             instance = Puppet::Parser::ResourceType.new(:hostclass, "foo::bar::baz")
             loader.add instance
             loader.find("foo::bar", "eh", :hostclass).should be_nil
@@ -170,36 +170,36 @@ describe Puppet::Parser::LoadedCode do
     end
 
     it "should use the generic 'find' method with an empty namespace to find nodes" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
         loader.expects(:find).with("", "bar", :node)
         loader.find_node("bar")
     end
 
     it "should use the generic 'find' method to find hostclasses" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
         loader.expects(:find).with("foo", "bar", :hostclass)
         loader.find_hostclass("foo", "bar")
     end
 
     it "should use the generic 'find' method to find definitions" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
         loader.expects(:find).with("foo", "bar", :definition)
         loader.find_definition("foo", "bar")
     end
 
     it "should indicate whether any nodes are defined" do
-        loader = Puppet::Parser::LoadedCode.new("env")
+        loader = Puppet::Parser::ResourceTypeCollection.new("env")
         loader.add_node(Puppet::Parser::ResourceType.new(:node, "foo"))
         loader.should be_nodes
     end
 
     it "should indicate whether no nodes are defined" do
-        Puppet::Parser::LoadedCode.new("env").should_not be_nodes
+        Puppet::Parser::ResourceTypeCollection.new("env").should_not be_nodes
     end
 
     describe "when finding nodes" do
         before :each do
-            @loader = Puppet::Parser::LoadedCode.new("env")
+            @loader = Puppet::Parser::ResourceTypeCollection.new("env")
         end
 
         it "should return any node whose name exactly matches the provided node name" do
diff --git a/spec/unit/util/rdoc/parser.rb b/spec/unit/util/rdoc/parser.rb
index c1b55a5..c62b01d 100755
--- a/spec/unit/util/rdoc/parser.rb
+++ b/spec/unit/util/rdoc/parser.rb
@@ -2,7 +2,7 @@
 
 Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
 
-require 'puppet/parser/loaded_code'
+require 'puppet/parser/resource_type_collection'
 require 'puppet/util/rdoc/parser'
 require 'puppet/util/rdoc/code_objects'
 require 'rdoc/options'
@@ -47,8 +47,8 @@ describe RDoc::Parser do
 
     describe "when scanning top level entities" do
         before :each do
-            @loadedcode = stub_everything 'loadedcode'
-            @parser.ast = @loadedcode
+            @resource_type_collection = stub_everything 'resource_type_collection'
+            @parser.ast = @resource_type_collection
             @parser.stubs(:split_module).returns("module")
 
             @topcontainer = stub_everything 'topcontainer'
@@ -148,7 +148,7 @@ describe RDoc::Parser do
         end
 
         it "should document classes in the parsed file" do
-            @loadedcode.add_hostclass(@klass)
+            @resource_type_collection.add_hostclass(@klass)
 
             @parser.expects(:document_class).with("myclass", @klass, @container)
 
@@ -157,7 +157,7 @@ describe RDoc::Parser do
 
         it "should not document class parsed in an other file" do
             @klass.stubs(:file).returns("/not/same/path/file.pp")
-            @loadedcode.add_hostclass(@klass)
+            @resource_type_collection.add_hostclass(@klass)
 
             @parser.expects(:document_class).with("myclass", @klass, @container).never
 
@@ -166,7 +166,7 @@ describe RDoc::Parser do
 
         it "should document vardefs for the main class" do
             @klass.stubs(:name).returns :main
-            @loadedcode.add_hostclass(@klass)
+            @resource_type_collection.add_hostclass(@klass)
 
             code = stub 'code', :is_a? => false
             @klass.stubs(:name).returns("")
@@ -178,7 +178,7 @@ describe RDoc::Parser do
         end
 
         it "should document definitions in the parsed file" do
-            @loadedcode.add_definition(@definition)
+            @resource_type_collection.add_definition(@definition)
 
             @parser.expects(:document_define).with("mydef", @definition, @container)
 
@@ -187,7 +187,7 @@ describe RDoc::Parser do
 
         it "should not document definitions parsed in an other file" do
             @definition.stubs(:file).returns("/not/same/path/file.pp")
-            @loadedcode.add_definition(@definition)
+            @resource_type_collection.add_definition(@definition)
 
             @parser.expects(:document_define).with("mydef", @definition, @container).never
 
@@ -195,7 +195,7 @@ describe RDoc::Parser do
         end
 
         it "should document nodes in the parsed file" do
-            @loadedcode.add_node(@node)
+            @resource_type_collection.add_node(@node)
 
             @parser.expects(:document_node).with("mynode", @node, @container)
 
@@ -204,7 +204,7 @@ describe RDoc::Parser do
 
         it "should not document node parsed in an other file" do
             @node.stubs(:file).returns("/not/same/path/file.pp")
-            @loadedcode.add_node(@node)
+            @resource_type_collection.add_node(@node)
 
             @parser.expects(:document_node).with("mynode", @node, @container).never
 
diff --git a/test/language/parser.rb b/test/language/parser.rb
index ca8ee75..6c68184 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -426,7 +426,7 @@ file { "/tmp/yayness":
         assert_nothing_raised do
             out = parser.parse ""
 
-            assert_instance_of(Puppet::Parser::LoadedCode, out)
+            assert_instance_of(Puppet::Parser::ResourceTypeCollection, out)
             assert_nil(parser.hostclass(""), "Got a 'main' class when we had no code")
         end
 
@@ -434,7 +434,7 @@ file { "/tmp/yayness":
         parser.initvars
         assert_nothing_raised do
             out = parser.parse "Exec { path => '/usr/bin:/usr/sbin' }"
-            assert_instance_of(Puppet::Parser::LoadedCode, out)
+            assert_instance_of(Puppet::Parser::ResourceTypeCollection, out)
             assert_equal("", parser.hostclass("").classname)
             assert_equal("", parser.hostclass("").namespace)
         end
@@ -801,7 +801,7 @@ file { "/tmp/yayness":
         assert_nothing_raised("Could not parse") do
             result = parser.parse(str)
         end
-        assert_instance_of(Puppet::Parser::LoadedCode, result, "Did not get a ASTSet back from parsing")
+        assert_instance_of(Puppet::Parser::ResourceTypeCollection, result, "Did not get a ASTSet back from parsing")
 
         assert_instance_of(AST::HostClass, result.hostclass("yay"), "Did not create 'yay' class")
         assert_instance_of(AST::HostClass, result.hostclass(""), "Did not create main class")

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list