Sha256: 7d880accb84afd2d1a149b4c70f5c720db8c95b7151a2f0a8cb6668865018715

Contents?: true

Size: 725 Bytes

Versions: 10

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusBolt::Payments::CaptureSyncService do
  subject(:capture) do
    described_class.call(payment: payment, capture_amount: capture_amount)
  end

  let(:payment) { create(:bolt_payment, amount: 15.00) }
  let(:capture_amount) { 1000 }

  describe '#call' do
    it 'completes the payment' do
      expect { capture }.to change { payment.reload.state }.from('checkout').to('completed')
    end

    it 'updates the payment amount' do
      expect { capture }.to change { payment.reload.amount }.from(15.00).to(10.00)
    end

    it 'creates a capture event' do
      capture
      expect(payment.reload.capture_events.count).to eq(1)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.7.1 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.7.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.6.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.5.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.4.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.3.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.2.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.1.0 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
solidus_bolt-0.0.1 spec/services/solidus_bolt/payments/capture_sync_service_spec.rb