summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-04 16:32:33 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit847233ffd66005124f23d028601dfe565c2bf026 (patch)
treec27cfea80adb8175137db599b5afc07c1ec10ca7 /spec/unit/parser
parent6e04fbaf0a3c0e500d1fb0944fa02fbaaf2eb1b8 (diff)
downloadpuppet-847233ffd66005124f23d028601dfe565c2bf026.tar.gz
puppet-847233ffd66005124f23d028601dfe565c2bf026.tar.xz
puppet-847233ffd66005124f23d028601dfe565c2bf026.zip
Adding []/[]= support to Parser::Resource
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/resource.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index d41d4f48b..2b57f7898 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -75,6 +75,16 @@ describe Puppet::Parser::Resource do
@resource.to_ral.should == "yay"
end
+ it "should be able to use the indexing operator to access parameters" do
+ resource = Puppet::Parser::Resource.new(:type => "resource", :title => "testing", :source => "source", :scope => "scope")
+ resource["foo"] = "bar"
+ resource["foo"].should == "bar"
+ end
+
+ it "should return the title when asked for a parameter named 'title'" do
+ Puppet::Parser::Resource.new(:type => "resource", :title => "testing", :source => "source", :scope => "scope")[:title].should == "testing"
+ end
+
describe "when initializing" do
before do
@arguments = {:type => "resource", :title => "testing", :scope => stub('scope', :source => mock('source'))}