Sha256: 354e95a031091cc346da2efbbcd31ef8b70c3e978adacbd009041003088323e1

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 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_paypal_braintree/factories'

  factory :solidus_paypal_braintree_payment_method, class: SolidusPaypalBraintree::Gateway do
    name 'Solidus PayPal Braintree Gateway'
    active true
  end

  factory :solidus_paypal_braintree_source, class: SolidusPaypalBraintree::Source do
    association(:payment_method, factory: :solidus_paypal_braintree_payment_method)
    user

    trait :credit_card do
      payment_type SolidusPaypalBraintree::Source::CREDIT_CARD
    end

    trait :paypal do
      payment_type SolidusPaypalBraintree::Source::PAYPAL
    end

    trait :apple_pay do
      payment_type SolidusPaypalBraintree::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

2 entries across 2 versions & 1 rubygems

Version Path
solidus_paypal_braintree-1.1.1 lib/solidus_paypal_braintree/factories.rb
solidus_paypal_braintree-1.1.0 lib/solidus_paypal_braintree/factories.rb