From 0931942e5a98116467d684fbfc21ea325eaa9207 Mon Sep 17 00:00:00 2001 From: maksim demin Date: Mon, 8 Oct 2012 21:45:09 -0700 Subject: [PATCH] subscribe_response returns the whole response in error case --- lib/zuora/objects/subscribe_request.rb | 2 +- spec/zuora/objects/subscribe_request_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/zuora/objects/subscribe_request.rb b/lib/zuora/objects/subscribe_request.rb index ff2294d..d30d98f 100644 --- a/lib/zuora/objects/subscribe_request.rb +++ b/lib/zuora/objects/subscribe_request.rb @@ -108,7 +108,7 @@ def apply_response(response_hash, type) return result else self.errors.add(:base, result[:errors][:message]) - return false + return result end end diff --git a/spec/zuora/objects/subscribe_request_spec.rb b/spec/zuora/objects/subscribe_request_spec.rb index 8ed3b78..020be8c 100644 --- a/spec/zuora/objects/subscribe_request_spec.rb +++ b/spec/zuora/objects/subscribe_request_spec.rb @@ -171,7 +171,8 @@ it "handles applying subscribe failures messages" do MockResponse.responds_with(:subscribe_request_failure) do subject.should be_valid - subject.create.should == false + sub_resp = subject.create + sub_resp[:success].should == false subject.errors[:base].should include('Initial Term should be greater than zero') end end