Sha256: 49d4256837b127a6eca9728c74226d32601986366341d778eb038f46f300e071

Contents?: true

Size: 1.67 KB

Versions: 7

Compression:

Stored size: 1.67 KB

Contents

# 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-2.0.1 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-2.0.0 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-1.1.0 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-1.0.1 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-1.0.0 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb
solidus_subscriptions-1.0.0.rc1 spec/lib/solidus_subscriptions/churn_buster/client_spec.rb