From: Michal Fojtik <mfoj...@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

Reply via email to