Sha256: a39cdc597f05b87ffb3debe25b703c0d967c589e187469d370f77156826a8b37

Contents?: true

Size: 1021 Bytes

Versions: 2

Compression:

Stored size: 1021 Bytes

Contents

require 'spec_helper'

describe SpreeAvataxOfficial::Transactions::VoidService do
  let(:order) { create(:completed_order_with_totals, number: 'R251928987', ship_address: create(:usa_address)) }

  describe '#call' do
    subject { described_class.call(order: order.reload) }

    context 'with correct parameters' do
      it 'returns positive result' do
        VCR.use_cassette('spree_avatax_official/transactions/void/success') do
          SpreeAvataxOfficial::Transactions::CreateService.call(order: order)

          result   = subject
          response = result.value

          expect(result.success?).to eq true
          expect(response['status']).to eq 'Cancelled'
        end
      end
    end

    context 'when order does NOT have SalesInvoice transaction' do
      it 'returns negative result' do
        result   = subject
        response = result.value

        expect(result.success?).to eq false
        expect(response).to eq 'Order is missing SalesInvoice transaction'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_avatax_official-1.8.0 spec/services/spree_avatax_official/transactions/void_service_spec.rb
spree_avatax_official-1.7.1 spec/services/spree_avatax_official/transactions/void_service_spec.rb