ACK

----- Original Message -----
From: [email protected]
To: [email protected]
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 <[email protected]>

---
 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
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to