Sha256: ced30eac3d7cff51cdeb0a2037997adf58a59e4b3d18cfa85207466c33124b3e

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

module Spree
  module SolidusSixSaferpay
    RSpec.describe InitializePayment do

      let(:order) { create(:order) }
      let(:payment_method) { create(:saferpay_payment_method) }

      let(:service) { described_class.new(order, payment_method) }

      describe '.call' do
        it 'calls an initialized service with given order and payment method' do
          expect(described_class).to receive(:new).with(order, payment_method).and_return(service)
          expect(service).to receive(:call)

          described_class.call(order, payment_method)
        end
      end

      describe '#call' do
        it 'fails because gateway raises an error' do
          expect { service.call }.to raise_error(NotImplementedError)
        end
      end

      describe '#gateway' do
        it 'raises an error because the gateway must be defined in subclasses' do
          expect { service.gateway }.to raise_error(NotImplementedError)
        end
      end

      describe '#success?' do
        it 'is initially false' do
          expect(service.success).to be false
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_six_saferpay-0.5.0 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb
solidus_six_saferpay-0.4.0 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb
solidus_six_saferpay-0.3.0 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb
solidus_six_saferpay-0.1.8.1 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb
solidus_six_saferpay-0.2.0 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb
solidus_six_saferpay-0.1.8 spec/services/spree/solidus_six_saferpay/initialize_payment_spec.rb