From 82eb7c64765d354f3df5ceaaf2830b71ce6871d2 Mon Sep 17 00:00:00 2001 From: cb-alish Date: Tue, 5 Nov 2024 09:51:29 +0530 Subject: [PATCH] Testcase fix --- spec/chargebee/list_result_spec.rb | 2 +- spec/chargebee_spec.rb | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/chargebee/list_result_spec.rb b/spec/chargebee/list_result_spec.rb index 95cb433..e5b4618 100644 --- a/spec/chargebee/list_result_spec.rb +++ b/spec/chargebee/list_result_spec.rb @@ -43,7 +43,7 @@ end before do - ChargeBee::Rest.stubs(:request).returns(response) + ChargeBee::NativeRequest.stubs(:request).returns(response) end it "returns list object, with next offset attribute" do diff --git a/spec/chargebee_spec.rb b/spec/chargebee_spec.rb index 3d6001b..9bd6586 100644 --- a/spec/chargebee_spec.rb +++ b/spec/chargebee_spec.rb @@ -1,11 +1,10 @@ require 'spec_helper' -require 'rest_client' require 'sample_response' describe "chargebee" do before(:all) do - @request = RestClient::Request + @request = ChargeBee::NativeRequest end it "serialize should convert the hash to acceptable format" do @@ -55,7 +54,7 @@ end it "should properly convert the response json into proper object" do - @request.expects(:execute).once.returns(mock_response(simple_subscription, headers)) + @request.expects(:request).once.returns(mock_response(simple_subscription, headers)) result = ChargeBee::Subscription.retrieve("simple_subscription") h = result.get_response_headers expect(h).to eq(headers) @@ -68,7 +67,7 @@ end it "should properly convert the nested response json into proper object with sub types" do - @request.expects(:execute).once.returns(mock_response(nested_subscription, headers)) + @request.expects(:request).once.returns(mock_response(nested_subscription, headers)) result = ChargeBee::Subscription.retrieve("nested_subscription") s = result.subscription expect(s.id).to eq("nested_subscription") @@ -80,7 +79,7 @@ end it "should properly convert the list response json into proper result object" do - @request.expects(:execute).once.returns(mock_response(list_subscriptions, headers)) + @request.expects(:request).once.returns(mock_response(list_subscriptions, headers)) result = ChargeBee::Subscription.list({:limit => 2}) expect(result.length).to eq(2) result.each do |i| @@ -89,7 +88,7 @@ end it "should parse event api response and provide the content properly" do - @request.expects(:execute).once.returns(mock_response(sample_event, headers)) + @request.expects(:request).once.returns(mock_response(sample_event, headers)) result = ChargeBee::Event.retrieve("sample_event") event = result.event s = event.content.subscription