summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/resource.rb2
-rwxr-xr-xspec/unit/parser/resource.rb9
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index 2e630a2b3..7fcb7c1fc 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -9,8 +9,10 @@ class Puppet::Parser::Resource < Puppet::Resource
require 'puppet/util/tagging'
require 'puppet/file_collection/lookup'
require 'puppet/parser/yaml_trimmer'
+ require 'puppet/resource/type_collection_helper'
include Puppet::FileCollection::Lookup
+ include Puppet::Resource::TypeCollectionHelper
include Puppet::Util
include Puppet::Util::MethodHelper
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 57c03c61b..9836910e7 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -69,6 +69,15 @@ describe Puppet::Parser::Resource do
Puppet::Parser::Resource.new("file", "whatever", :scope => scope).namespaces.should == %w{one two}
end
+ it "should use the resource type collection helper module" do
+ Puppet::Parser::Resource.ancestors.should be_include(Puppet::Resource::TypeCollectionHelper)
+ end
+
+ it "should use the scope's environment as its environment" do
+ @scope.expects(:environment).returns "myenv"
+ Puppet::Parser::Resource.new(:type => "file", :title => "whatever", :scope => @scope).environment.should == "myenv"
+ end
+
it "should be isomorphic if it is builtin and models an isomorphic type" do
Puppet::Type.type(:file).expects(:isomorphic?).returns(true)
@resource = Puppet::Parser::Resource.new("file", "whatever", :scope => @scope, :source => @source).isomorphic?.should be_true