Signed-off-by: Luke Kanies <[EMAIL PROTECTED]> --- lib/puppet/type.rb | 4 ++-- spec/unit/type.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 7e86549..7a1c8b4 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -2487,8 +2487,8 @@ class Type trans = TransObject.new(self.title, self.class.name) values = retrieve() - values.each do |name, value| - trans[name.name] = value + values.each do |param, value| + trans[param.name] = param.is_to_s(value) end @parameters.each do |name, param| diff --git a/spec/unit/type.rb b/spec/unit/type.rb index 5e6cf33..903936a 100755 --- a/spec/unit/type.rb +++ b/spec/unit/type.rb @@ -61,4 +61,18 @@ describe Puppet::Type do @catalog.clear(true) end end + + describe "when converting to a transportable resource" do + before do + @user = Puppet::Type.type(:user).create(:name => "to_trans_testing", :ensure => :present) + end + + it "should use each parameter's 'is_to_s' method to display the value" do + # Use 'ensure' because none of the other props will be tested if the user is absent. + @user.property(:ensure).expects(:retrieve).returns :absent + @user.property(:ensure).expects(:is_to_s).with(:absent) + + @user.to_trans + end + end end -- 1.5.3.7 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---