Sha256: a66f7712e7cbb267d7e75a422677f3c7cb7c0dea9d6d56e3c0423ad2701cf8f2

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  # Define your Spree extensions Factories within this file to enable applications,
  # and other extensions to use and override them.
  #
  # Example adding this to your spec_helper will load these Factories for use:
  # require 'solidus_braintree/factories'

  factory :solidus_braintree_payment_method, class: SolidusBraintree::Gateway do
    name { 'Solidus Braintree Gateway' }
    active { true }
  end

  factory :solidus_braintree_source, class: SolidusBraintree::Source do
    association(:payment_method, factory: :solidus_braintree_payment_method)
    user

    trait :credit_card do
      payment_type { SolidusBraintree::Source::CREDIT_CARD }
    end

    trait :paypal do
      payment_type { SolidusBraintree::Source::PAYPAL }
    end

    trait :apple_pay do
      payment_type { SolidusBraintree::Source::APPLE_PAY }
    end
  end
end

FactoryBot.modify do
  # The Solidus address factory randomizes the zipcode.
  # The OrderWalkThrough we use in the credit card checkout spec uses this factory for the user addresses.
  # For credit card payments we transmit the billing address to braintree, for paypal payments the shipping address.
  # As we match the body in our VCR settings VCR can not match the request anymore and therefore cannot replay existing
  # cassettes.
  #

  factory :address do
    zipcode { '21088-0255' }

    if SolidusSupport.combined_first_and_last_name_in_address?
      transient do
        firstname { "John" }
        lastname { "Doe" }
      end

      name { "#{firstname} #{lastname}" }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_braintree-2.0.0 lib/solidus_braintree/testing_support/factories.rb