Sha256: b08d5cc3d367fbb12c29ce0ff6570b550cf97104a5b84ff80b2556e9539987fa

Contents?: true

Size: 1.32 KB

Versions: 33

Compression:

Stored size: 1.32 KB

Contents

FactoryBot.define do
  factory :payment_method, class: Spree::PaymentMethod do
    type { 'Spree::PaymentMethod' }
    name { 'Test' }

    before(:create) do |payment_method|
      if payment_method.stores.empty?
        default_store = Spree::Store.default.persisted? ? Spree::Store.default : nil
        store = default_store || create(:store)

        payment_method.stores << store
      end
    end
  end

  factory :check_payment_method, parent: :payment_method, class: Spree::PaymentMethod::Check do
    type { 'Spree::PaymentMethod::Check' }
    name { 'Check' }
  end

  factory :credit_card_payment_method, parent: :payment_method, class: Spree::Gateway::Bogus do
    type { 'Spree::Gateway::Bogus' }
    name { 'Credit Card' }
  end

  # authorize.net was moved to spree_gateway.
  # Leaving this factory in place with bogus in case anyone is using it.
  factory :simple_credit_card_payment_method, parent: :payment_method, class: Spree::Gateway::BogusSimple do
    type { 'Spree::Gateway::BogusSimple' }
    name { 'Credit Card' }
  end

  factory :store_credit_payment_method, parent: :payment_method, class: Spree::PaymentMethod::StoreCredit do
    type          { 'Spree::PaymentMethod::StoreCredit' }
    name          { 'Store Credit' }
    description   { 'Store Credit' }
    active        { true }
    auto_capture  { true }
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
spree_core-4.10.1 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.10.0 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.9.0 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.8.3 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.8.2 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.7.3 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.6 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.5.5 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.3.3 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.4.1 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.5.4 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.5 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.7.2 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.7.1 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.4 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.7.0 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.3 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.2 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.1 lib/spree/testing_support/factories/payment_method_factory.rb
spree_core-4.6.0 lib/spree/testing_support/factories/payment_method_factory.rb