You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/11/17 19:46:35 UTC
svn commit: r1203321 - /incubator/deltacloud/trunk/server/spec/spec_helper.rb
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?