Sha256: d6fbf6fde4f2f2725a57e7ef55320a32e1f942df09c28eb533fcae277d1fd8ff

Contents?: true

Size: 500 Bytes

Versions: 5

Compression:

Stored size: 500 Bytes

Contents

FactoryBot.define do
  factory :stripe_product do
    sequence(:name) { |n| "Stripe product #{n}" }
    sequence(:stripe_id) { |n| "stripe-product-#{n}" }

    trait :with_stripe_mock do
      after :create do |stripe_product|
        mock_product = Stripe::Product.create(
          id: stripe_product.stripe_id,
          name: stripe_product.name,
          type: "service"
        )
        stripe_product.assign_from_stripe(mock_product)
        stripe_product.save!
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.7 lib/stripe_model_callbacks/factories/stripe_products.rb
stripe_model_callbacks-0.1.6 lib/stripe_model_callbacks/factories/stripe_products.rb
stripe_model_callbacks-0.1.5 lib/stripe_model_callbacks/factories/stripe_products.rb
stripe_model_callbacks-0.1.4 lib/stripe_model_callbacks/factories/stripe_products.rb
stripe_model_callbacks-0.1.3 lib/stripe_model_callbacks/factories/stripe_products.rb