Skip to content

Commit

Permalink
Testcase fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-alish committed Nov 5, 2024
1 parent 3c67229 commit 32ec76a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GEM

PLATFORMS
arm64-darwin-21
arm64-darwin-23
x86_64-darwin-20
x86_64-linux

Expand Down
2 changes: 1 addition & 1 deletion spec/chargebee/list_result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions spec/chargebee_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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([simple_subscription, headers])
result = ChargeBee::Subscription.retrieve("simple_subscription")
h = result.get_response_headers
expect(h).to eq(headers)
Expand All @@ -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([nested_subscription, headers])
result = ChargeBee::Subscription.retrieve("nested_subscription")
s = result.subscription
expect(s.id).to eq("nested_subscription")
Expand All @@ -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([list_subscriptions, headers])
result = ChargeBee::Subscription.list({:limit => 2})
expect(result.length).to eq(2)
result.each do |i|
Expand All @@ -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([sample_event, headers])
result = ChargeBee::Event.retrieve("sample_event")
event = result.event
s = event.content.subscription
Expand Down

0 comments on commit 32ec76a

Please sign in to comment.