deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1203321 - /incubator/deltacloud/trunk/server/spec/spec_helper.rb
Date Thu, 17 Nov 2011 18:46:35 GMT
Author: mfojtik
Date: Thu Nov 17 18:46:34 2011
New Revision: 1203321

URL: http://svn.apache.org/viewvc?rev=1203321&view=rev
Log:
CIMI: Added helper methods to check serialization and inconsistencies between JSON and XML

Modified:
    incubator/deltacloud/trunk/server/spec/spec_helper.rb

Modified: incubator/deltacloud/trunk/server/spec/spec_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/spec/spec_helper.rb?rev=1203321&r1=1203320&r2=1203321&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/spec/spec_helper.rb (original)
+++ incubator/deltacloud/trunk/server/spec/spec_helper.rb Thu Nov 17 18:46:34 2011
@@ -90,6 +90,16 @@ class HashCmp
   end
 end
 
+def should_serialize_from_xml!(model, xml, json)
+  model.to_xml.should serialize_to xml, :fmt => :xml
+  model.to_json.should serialize_to json, :fmt => :json
+end
+
+def should_serialize_from_json!(model, xml, json)
+  model.to_xml.should serialize_to xml, :fmt => :xml
+  model.to_json.should serialize_to json, :fmt => :json
+end
+
 RSpec::Matchers.define :serialize_to do |exp, opts|
   match do |act|
     matcher(exp, act, opts[:fmt]).match?



Mime
View raw message