Sha256: 39194f26a112e23d566f8cd22f019fc803e5059cc346e755364abcbf52b6ac79

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Spree::WalletPaymentSource do
  describe 'setting it as the default' do
    it 'reports a payment method changed event for subscriptions that use the default payment source' do
      stub_const('Spree::Event', class_spy(Spree::Event))
      user = create(:user)
      subscription = create(:subscription, user: user)
      payment_source = create(:credit_card, user: user)
      wallet_payment_source = user.wallet.add(payment_source)

      user.wallet.default_wallet_payment_source = wallet_payment_source

      expect(Spree::Event).to have_received(:fire).with(
        'solidus_subscriptions.subscription_payment_method_changed',
        subscription: subscription,
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_subscriptions-1.0.0 spec/models/spree/wallet_payment_source_spec.rb
solidus_subscriptions-1.0.0.rc1 spec/models/spree/wallet_payment_source_spec.rb