Sha256: 53e88c089f7a980c61b66afc55086b1b99a7d914cc7c65193a9b0fb4e1bcb24d

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusBolt::Transactions::BaseService do
  let!(:payment_method) { create(:bolt_payment_method) }

  describe '#call' do
    subject(:service) { described_class.new(payment_method: payment_method).call }

    it 'raises a not implemented error' do
      expect { service }.to raise_error(::NotImplementedError)
    end
  end

  describe '#api_base_url' do
    it 'returns correct url' do
      expect(
        described_class.new(payment_method: payment_method).send(:api_base_url)
      ).to eq payment_method.preferred_bolt_api_url
    end
  end

  describe '#authentication_header' do
    it 'returns the correct hash' do
      expect(
        described_class.new(payment_method: payment_method).send(:authentication_header)
      ).to eq({ 'X-API-KEY' => payment_method.preferred_bolt_api_key })
    end
  end

  describe '#publishable_key' do
    it 'returns the correct key' do
      publishable_key = described_class.new(payment_method: payment_method).send(:publishable_key)
      expect(described_class.new(payment_method: payment_method).send(:publishable_key)).to eq(publishable_key)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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