Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 80791995F for ; Wed, 16 Nov 2011 20:35:05 +0000 (UTC) Received: (qmail 3741 invoked by uid 500); 16 Nov 2011 20:35:05 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 3719 invoked by uid 500); 16 Nov 2011 20:35:05 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 3710 invoked by uid 99); 16 Nov 2011 20:35:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2011 20:35:05 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2011 20:34:59 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAGKYbPQ001355 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Nov 2011 15:34:37 -0500 Received: from localhost.localdomain (vpn1-5-194.ams2.redhat.com [10.36.5.194]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAGKYZm1013538 for ; Wed, 16 Nov 2011 15:34:37 -0500 From: mfojtik@redhat.com To: deltacloud-dev@incubator.apache.org Subject: [PATCH core 1/4] CIMI: Added helper methods to check serialization and inconsistencies between JSON and XML Date: Wed, 16 Nov 2011 21:34:30 +0100 Message-Id: <1321475673-14645-2-git-send-email-mfojtik@redhat.com> In-Reply-To: <1321475673-14645-1-git-send-email-mfojtik@redhat.com> References: <1321475673-14645-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 From: Michal Fojtik --- 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