incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 1/4] CIMI: Added helper methods to check serialization and inconsistencies between JSON and XML
Date Wed, 16 Nov 2011 20:34:30 GMT
From: Michal Fojtik <mfojtik@redhat.com>

---
 server/spec/spec_helper.rb |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/server/spec/spec_helper.rb b/server/spec/spec_helper.rb
index d046260..c8b41fc 100644
--- a/server/spec/spec_helper.rb
+++ b/server/spec/spec_helper.rb
@@ -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?
-- 
1.7.7.3


Mime
View raw message