Sha256: b2768bfed42600273326166477ea09237b55534c1805004e7856d29b4fe53390

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

RSpec.describe SolidusSupport do
  describe '.payment_method_parent_class' do
    subject { described_class.payment_method_parent_class(credit_card: credit_card) }

    let(:credit_card) { nil }

    before do
      allow(described_class).to receive(:solidus_gem_version) do
        Gem::Version.new(solidus_version)
      end
    end

    context 'with Solidus < 2.3' do
      let(:solidus_version) { '2.2.1' }

      it { is_expected.to eq(Spree::Gateway) }
    end

    context 'with Solidus >= 2.3' do
      let(:solidus_version) { '2.3.1' }

      it { is_expected.to eq(Spree::PaymentMethod) }
    end

    # rubocop:disable RSpec/NestedGroups
    context 'with credit_card: true' do
      let(:credit_card) { true }

      context 'with Solidus < 2.3' do
        let(:solidus_version) { '2.2.1' }

        it { is_expected.to eq(Spree::Gateway) }
      end

      context 'with Solidus >= 2.3' do
        let(:solidus_version) { '2.3.1' }

        it { is_expected.to eq(Spree::PaymentMethod::CreditCard) }
      end
    end
    # rubocop:enable RSpec/NestedGroups
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_support-0.5.1 spec/solidus_support_spec.rb
solidus_support-0.5.0 spec/solidus_support_spec.rb
solidus_support-0.4.1 spec/solidus_support_spec.rb
solidus_support-0.4.0 spec/solidus_support_spec.rb