blob: 9efb2e640de6473b367a94adf1e90239e558d35e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# frozen_string_literal: true
RSpec.describe SolidusSubscriptions::ChurnBuster::Client, vcr: { cassette_name: 'churn_buster', record: :new_episodes } do
describe '#report_failed_payment' do
it 'reports the failed payment to Churn Buster' do
client = described_class.new(
account_id: 'test_account_id',
api_key: 'test_api_key',
)
order = create(:order, subscription: create(:subscription))
response = client.report_failed_payment(order)
expect(response).to be_success
end
end
describe '#report_successful_payment' do
it 'reports the successful payment to Churn Buster' do
client = described_class.new(
account_id: 'test_account_id',
api_key: 'test_api_key',
)
order = create(:order, subscription: create(:subscription))
response = client.report_successful_payment(order)
expect(response).to be_success
end
end
describe '#report_subscription_cancellation' do
it 'reports the failed payment to Churn Buster' do
client = described_class.new(
account_id: 'test_account_id',
api_key: 'test_api_key',
)
subscription = create(:subscription)
response = client.report_subscription_cancellation(subscription)
expect(response).to be_success
end
end
describe '#report_payment_method_change' do
it 'reports the payment method change to Churn Buster' do
client = described_class.new(
account_id: 'test_account_id',
api_key: 'test_api_key',
)
subscription = create(:subscription)
response = client.report_payment_method_change(subscription)
expect(response).to be_success
end
end
end
|