Sha256: 725f1d9f3338714bde78d22abf37143a631ab056d713f1019eec15bbd20f2365

Contents?: true

Size: 825 Bytes

Versions: 5

Compression:

Stored size: 825 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('SolidusSupport::LegacyEventCompat::Bus', class_spy(SolidusSupport::LegacyEventCompat::Bus))
      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(SolidusSupport::LegacyEventCompat::Bus).to have_received(:publish).with(
        :'solidus_subscriptions.subscription_payment_method_changed',
        subscription: subscription,
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/models/spree/wallet_payment_source_spec.rb
solidus_subscriptions-2.0.1 spec/models/spree/wallet_payment_source_spec.rb
solidus_subscriptions-2.0.0 spec/models/spree/wallet_payment_source_spec.rb
solidus_subscriptions-1.1.0 spec/models/spree/wallet_payment_source_spec.rb
solidus_subscriptions-1.0.1 spec/models/spree/wallet_payment_source_spec.rb