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 82eb7c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
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(mock_response(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(mock_response(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(mock_response(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(mock_response(sample_event, headers))
result = ChargeBee::Event.retrieve("sample_event")
event = result.event
s = event.content.subscription
Expand Down

0 comments on commit 82eb7c6

Please sign in to comment.