Sha256: 8949b30862db90b9313d6777f81843f2aac9fe84e22f7d2ccdf311537483121d

Contents?: true

Size: 1 KB

Versions: 48

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'rails_helper'
require 'spree/testing_support/factories/payment_factory'

RSpec.describe 'payment factory' do
  let(:factory_class) { Spree::Payment }

  describe 'plain (credit card) payment' do
    let(:factory) { :payment }

    it_behaves_like 'a working factory'

    it "assigns the Order's user to the created Credit Card" do
      payment = create(factory)
      expect(payment.source.user).to be_present
      expect(payment.source.user).to eq payment.order.user
    end

    it 'uses the orders bill address for the credit card' do
      address = create(:address)
      order = create(:order, bill_address: address)
      payment = create(factory, order: order)

      expect(payment.source.address).to eq address
    end
  end

  describe 'check payment' do
    let(:factory) { :check_payment }

    it_behaves_like 'a working factory'
  end

  describe 'store credit payment' do
    let(:factory) { :store_credit_payment }

    it_behaves_like 'a working factory'
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.10.3 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.10.2 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.6 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.8.6 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.10.1 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.5 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.10.0 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.4 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.6.6 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.7.4 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.8.5 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.3 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.2 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.10.0.beta1 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.7.3 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.6.5 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.1 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.0 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb
solidus_core-2.9.0.rc.1 spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb