ACK
----- Original Message -----
From: jprovazn(a)redhat.com
To: deltacloud-devel(a)lists.fedorahosted.org
Sent: Wednesday, December 8, 2010 3:15:31 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome /
Stockholm / Vienna
Subject: [deltacloud-devel] [PATCH aggregator] Fixed generating of template xml
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/models/template.rb | 2 +-
src/spec/models/template_spec.rb | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/app/models/template.rb b/src/app/models/template.rb
index 74bf208..f660671 100644
--- a/src/app/models/template.rb
+++ b/src/app/models/template.rb
@@ -53,7 +53,7 @@ class Template < ActiveRecord::Base
xml.platform = self.platform
xml.platform_version = self.platform_version
xml.architecture = self.architecture
- write_attribute(:xml, xml.to_s)
+ write_attribute(:xml, xml.to_xml)
end
def providers
diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb
index 94de1df..4a42996 100644
--- a/src/spec/models/template_spec.rb
+++ b/src/spec/models/template_spec.rb
@@ -29,4 +29,12 @@ describe Template do
inst.template.destroy
end.should_not change(Template, :count)
end
+
+ it "should update xml when template is saved" do
+ tpl = Factory.build(:template)
+ tpl.packages = ['test']
+ tpl.save!
+ tpl2 = Template.find(tpl)
+ tpl2.packages.should == ['test']
+ end
end
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
deltacloud-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/deltacloud-devel