diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-07-15 16:38:04 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-18 19:44:13 -0700 |
| commit | d319da41e46f0f3621180d09d3110f67003a7527 (patch) | |
| tree | e69c8969dc25c2dd155ac49e2345e170830f5784 /spec | |
| parent | 9f915402f5cf54c0f78dd34fefdde5f2f840cda7 (diff) | |
| download | puppet-d319da41e46f0f3621180d09d3110f67003a7527.tar.gz puppet-d319da41e46f0f3621180d09d3110f67003a7527.tar.xz puppet-d319da41e46f0f3621180d09d3110f67003a7527.zip | |
[#4247] storeconfigs was calling Puppet::Parser::Resource.new with the wrong arguments
When the interface to Puppet::Resource changed, its subclass
Puppet::Parser::Resource was also affected. One case of initializing
those objects did not get updated when the code changed, causing
storeconfigs to break.
Also, this patch adds a error message that would have made it easier to
catch this problem (as puppet could consume all memory and die trying to
print the old error message)
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/rails/resource_spec.rb | 16 | ||||
| -rwxr-xr-x | spec/unit/resource_spec.rb | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/rails/resource_spec.rb b/spec/unit/rails/resource_spec.rb index ac7469355..08deda65e 100755 --- a/spec/unit/rails/resource_spec.rb +++ b/spec/unit/rails/resource_spec.rb @@ -104,4 +104,20 @@ describe "Puppet::Rails::Resource" do @resource.merge_parameters(merge_resource) end end + + describe "#to_resource" do + it "should instantiate a Puppet::Parser::Resource" do + scope = stub "scope", :source => nil + + @resource = Puppet::Rails::Resource.new + @resource.stubs(:attributes).returns({ + "restype" => 'notify', + "title" => 'hello' + }) + @resource.stubs(:param_names).returns([]) + + @resource.to_resource(scope).should be_a(Puppet::Parser::Resource) + + end + end end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 95f0dd04b..204a2b02e 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -98,6 +98,12 @@ describe Puppet::Resource do lambda { Puppet::Resource.new("foo") }.should raise_error(ArgumentError) end + it "should fail if the title is a hash and the type is not a valid resource reference string" do + lambda { Puppet::Resource.new({:type => "foo", :title => "bar"}) }.should raise_error(ArgumentError, + 'Puppet::Resource.new does not take a hash as the first argument. Did you mean ("foo", "bar") ?' + ) + end + it "should be able to produce a backward-compatible reference array" do Puppet::Resource.new("foobar", "/f").to_trans_ref.should == %w{Foobar /f} end |
