Sha256: e8391ca5816583c03b8466ec0bf9c7acc77c29fa573cf7c0df4683ff8233beb6

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

RSpec.describe SolidusSubscriptions::Dispatcher::SuccessDispatcher do
  describe '#dispatch' do
    it 'marks the installment as success' do
      installment = instance_spy(SolidusSubscriptions::Installment)
      order = create(:order_with_line_items)

      dispatcher = described_class.new(installment, order)
      dispatcher.dispatch

      expect(installment).to have_received(:success!).with(order)
    end

    it 'fires an installments_succeeded event' do
      stub_const('SolidusSupport::LegacyEventCompat::Bus', class_spy(SolidusSupport::LegacyEventCompat::Bus))
      installment = instance_spy(SolidusSubscriptions::Installment)
      order = create(:order_with_line_items)

      dispatcher = described_class.new(installment, order)
      dispatcher.dispatch

      expect(SolidusSupport::LegacyEventCompat::Bus).to have_received(:publish).with(
        :'solidus_subscriptions.installment_succeeded',
        installment: installment,
        order: order,
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb
solidus_subscriptions-2.0.1 spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb
solidus_subscriptions-2.0.0 spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb
solidus_subscriptions-1.1.0 spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb
solidus_subscriptions-1.0.1 spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb