diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-07-07 09:36:27 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-07 11:14:51 -0700 |
| commit | 4b00c6af911b447265fc3e7ab19bb076840bfef1 (patch) | |
| tree | 08453970292d9c6e4ddd67d3ac31562d236ce3e9 /spec | |
| parent | 5f8a2424bcd4f78e71963060b375e12167c7bbef (diff) | |
[#4110] Wrap Type#retrieve calls for backwards compatibility
This patch introduces Type#retrieve_resource as a wrapper for
Type#resource, to coerce the return value from legacy types from Hash to
Resource.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/type_spec.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 54fb2978c..70597f748 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -368,11 +368,11 @@ describe Puppet::Type do it "should fail if its provider is unsuitable" do @resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present) @resource.provider.class.expects(:suitable?).returns false - lambda { @resource.retrieve }.should raise_error(Puppet::Error) + lambda { @resource.retrieve_resource }.should raise_error(Puppet::Error) end it "should return a Puppet::Resource instance with its type and title set appropriately" do - result = @resource.retrieve + result = @resource.retrieve_resource result.should be_instance_of(Puppet::Resource) result.type.should == "Mount" result.title.should == "foo" @@ -381,11 +381,11 @@ describe Puppet::Type do it "should set the name of the returned resource if its own name and title differ" do @resource[:name] = "my name" @resource.title = "other name" - @resource.retrieve[:name].should == "my name" + @resource.retrieve_resource[:name].should == "my name" end it "should provide a value for all set properties" do - values = @resource.retrieve + values = @resource.retrieve_resource [:ensure, :fstype, :pass].each { |property| values[property].should_not be_nil } end @@ -396,13 +396,13 @@ describe Puppet::Type do it "should not call retrieve on non-ensure properties if the resource is absent and should consider the property absent" do @resource.property(:ensure).expects(:retrieve).returns :absent @resource.property(:fstype).expects(:retrieve).never - @resource.retrieve[:fstype].should == :absent + @resource.retrieve_resource[:fstype].should == :absent end it "should include the result of retrieving each property's current value if the resource is present" do @resource.property(:ensure).expects(:retrieve).returns :present @resource.property(:fstype).expects(:retrieve).returns 15 - @resource.retrieve[:fstype] == 15 + @resource.retrieve_resource[:fstype] == 15 end end |
