Sha256: ac3aae685fe4a836e4bd178301a1087a249f85889c9a75862bf779634abc4a78

Contents?: true

Size: 895 Bytes

Versions: 7

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SolidusSubscriptions::Dispatcher::FailureDispatcher do
  describe '#dispatch' do
    it 'marks the installment as failed' 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(:failed!).with(order)
    end

    it 'cancels the order' do
      if Spree.solidus_gem_version > Gem::Version.new('2.10')
        skip 'Orders in `cart` state cannot be canceled starting from Solidus 2.11.'
      end

      installment = instance_spy(SolidusSubscriptions::Installment)
      order = create(:order_with_line_items)

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

      expect(order.state).to eq('canceled')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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