diff options
Diffstat (limited to 'spec/unit/parser/parser.rb')
-rwxr-xr-x | spec/unit/parser/parser.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb index f10517fd7..16e469fd8 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 |