repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/imported_customers.rb | spec/support/factories/imported_customers.rb | # frozen_string_literal: true
FactoryBot.define do
factory :imported_customer do
association :importing_user, factory: :user
email { generate :email }
purchase_date { Time.current }
link_id { 1 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/banks.rb | spec/support/factories/banks.rb | # frozen_string_literal: true
FactoryBot.define do
factory :bank do
routing_number { "9999999999" }
name { "Bank of America" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sequences.rb | spec/support/factories/sequences.rb | # frozen_string_literal: true
FactoryBot.define do
sequence(:browser_guid) do |n|
["SDJKF-#{n}-#{rand(99_999)}-DSFKLLFK", "SDFJKLDF-#{n}-#{rand(999_999)}-JDSFKLDSF", "JKDDSFJKSFD-#{n}-#{rand(99_999)}-SDFJ"].sample
end
sequence(:username) { |n| "edgar#{SecureRandom.hex(4)}#{n}" }
sequence(:email) { |n| "edgar#{SecureRandom.hex(4)}_#{n}@gumroad.com" }
sequence(:fixed_username) { |n| "edgar#{n}" }
sequence(:fixed_email) { |n| "edgar_#{n}@gumroad.com" }
sequence(:ip) { ["4.167.234.0", "199.21.86.138", "12.38.32.0", "64.115.250.0"].sample }
sequence(:token) { |n| "#{("a".."z").to_a.shuffle.join}#{n}" }
sequence(:fixed_timestamp) { |n| DateTime.parse("2021-12-02 01:22:10") + n.minutes }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/tips.rb | spec/support/factories/tips.rb | # frozen_string_literal: true
FactoryBot.define do
factory :tip do
value_cents { 100 }
purchase
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/mexico_bank_accounts.rb | spec/support/factories/mexico_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :mexico_bank_account do
user
account_number { "000000001234567897" }
account_number_last_four { "7897" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/colombia_bank_accounts.rb | spec/support/factories/colombia_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :colombia_bank_account do
user
account_number { "000123456789" }
account_number_last_four { "6789" }
bank_code { "060" }
account_type { "savings" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_review_videos.rb | spec/support/factories/product_review_videos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_review_video do
association :product_review
approval_status { :pending_review }
after(:build) do |video|
video.video_file ||= build(:video_file, record: video)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/devices.rb | spec/support/factories/devices.rb | # frozen_string_literal: true
FactoryBot.define do
factory :device do
token { generate(:token) }
app_version { "1.0.0" }
device_type { "ios" }
app_type { Device::APP_TYPES[:creator] }
user
factory :android_device do
device_type { "android" }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/legacy_permalinks.rb | spec/support/factories/legacy_permalinks.rb | # frozen_string_literal: true
FactoryBot.define do
factory :legacy_permalink do
product
permalink { SecureRandom.hex(15) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/north_macedonia_bank_accounts.rb | spec/support/factories/north_macedonia_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :north_macedonia_bank_account do
user
account_number { "MK49250120000058907" }
account_number_last_four { "8907" }
account_holder_full_name { "Gumbot Gumstein I" }
bank_code { "AAAAMK2XXXX" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/team_memberships.rb | spec/support/factories/team_memberships.rb | # frozen_string_literal: true
FactoryBot.define do
factory :team_membership do
user
association :seller, factory: :user
role { TeamMembership::ROLE_ADMIN }
before(:create) do |team_membership|
team_membership.user.create_owner_membership_if_needed!
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/call_limitation_infos.rb | spec/support/factories/call_limitation_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :call_limitation_info do
call { create(:call_product) }
minimum_notice_in_minutes { 60 }
maximum_calls_per_day { 10 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/bulgaria_bank_accounts.rb | spec/support/factories/bulgaria_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :bulgaria_bank_account do
user
account_number { "BG80BNBG96611020345678" }
account_number_last_four { "2874" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/creator_contacting_customers_email_infos.rb | spec/support/factories/creator_contacting_customers_email_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :creator_contacting_customers_email_info do
purchase
installment
email_name { "purchase_installment" }
state { "created" }
factory :creator_contacting_customers_email_info_sent do
state { "sent" }
sent_at { Time.current }
factory :creator_contacting_customers_email_info_delivered do
state { "delivered" }
delivered_at { Time.current }
factory :creator_contacting_customers_email_info_opened do
state { "opened" }
opened_at { Time.current }
end
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/chargeables.rb | spec/support/factories/chargeables.rb | # frozen_string_literal: true
FactoryBot.define do
factory :chargeable, class: Chargeable do
skip_create # Chargeable is not an ActiveRecord object
transient do
card { StripePaymentMethodHelper.success }
expiry_date { card[:expiry_date] }
cvc { card[:cvc] }
with_zip_code { nil }
cc_zipcode do
card = self.card
# if with_zip_code has been set, take the action of adding or removing zip code from the card params in use
# but if with_zip_code has not been set (nil) do nothing to the card params
case with_zip_code
when true
card = card.with_zip_code
when false
card = card.without(:cc_zip_code)
end
card[:cc_zipcode]
end
product_permalink { "xx" }
end
initialize_with do
self.card[:expiry_date] = expiry_date
self.card[:cvc] = cvc
self.card[:cc_zipcode] = cc_zipcode
Chargeable.new([
StripeChargeablePaymentMethod.new(self.card.to_stripejs_payment_method_id, zip_code: self.card[:cc_zipcode], product_permalink:)
])
end
factory :chargeable_zip_check_unsupported do
transient do
card { StripePaymentMethodHelper.success_zip_check_unsupported }
end
end
factory :chargeable_zip_check_fails do
transient do
card { StripePaymentMethodHelper.success_zip_check_fails }
end
end
factory :chargeable_decline do
transient do
card { StripePaymentMethodHelper.decline }
end
end
factory :chargeable_success_charge_decline do
transient do
card { StripePaymentMethodHelper.success_charge_decline }
end
end
factory :chargeable_success_charge_disputed do
transient do
card { StripePaymentMethodHelper.success_charge_disputed }
end
end
factory :chargeable_decline_cvc_check_fails do
transient do
card { StripePaymentMethodHelper.decline_cvc_check_fails }
end
end
end
factory :cc_token_chargeable, class: Chargeable do
skip_create # Chargeable is not an ActiveRecord object
transient do
card { CardParamsSpecHelper.success }
expiry_date { card[:expiry_date] }
cvc { card[:cvc] }
with_zip_code { nil }
cc_zipcode do
card = self.card
# if with_zip_code has been set, take the action of adding or removing zip code from the card params in use
# but if with_zip_code has not been set (nil) do nothing to the card params
case with_zip_code
when true
card = card.with_zip_code
when false
card = card.without(:cc_zip_code)
end
card[:cc_zipcode]
end
end
initialize_with do
self.card[:expiry_date] = expiry_date
self.card[:cvc] = cvc
self.card[:cc_zipcode] = cc_zipcode
Chargeable.new([
StripeChargeableToken.new(self.card.to_stripejs_token, self.card[:cc_zipcode], product_permalink: "xx")
])
end
end
factory :paypal_chargeable, class: Chargeable do
skip_create
initialize_with do
Chargeable.new([
BraintreeChargeableNonce.new(Braintree::Test::Nonce::PayPalFuturePayment, nil)
])
end
end
factory :native_paypal_chargeable, class: Chargeable do
skip_create
initialize_with do
Chargeable.new([
PaypalChargeable.new("B-8AM85704X2276171X", "paypal_paypal-gr-integspecs@gumroad.com", "US")
])
end
end
factory :paypal_approved_order_chargeable, class: Chargeable do
skip_create
initialize_with do
Chargeable.new([
PaypalApprovedOrderChargeable.new("9XX680320L106570A", "paypal_paypal-gr-integspecs@gumroad.com", "US")
])
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/commissions.rb | spec/support/factories/commissions.rb | # frozen_string_literal: true
FactoryBot.define do
factory :commission do
status { "in_progress" }
association :deposit_purchase, factory: :commission_deposit_purchase
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/custom_fields.rb | spec/support/factories/custom_fields.rb | # frozen_string_literal: true
FactoryBot.define do
factory :custom_field do
name { "Custom field" }
seller { create(:user) }
field_type { "text" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/serbia_bank_accounts.rb | spec/support/factories/serbia_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :serbia_bank_account do
user
account_number { "RS35105008123123123173" }
account_number_last_four { "3173" }
bank_code { "TESTSERBXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/credit_cards.rb | spec/support/factories/credit_cards.rb | # frozen_string_literal: true
FactoryBot.define do
factory :credit_card do
transient do
chargeable { build(:chargeable) }
user { nil }
end
initialize_with do
CreditCard.create(chargeable, nil, user)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/resource_subscriptions.rb | spec/support/factories/resource_subscriptions.rb | # frozen_string_literal: true
FactoryBot.define do
factory :resource_subscription do
user
oauth_application
resource_name { "sale" }
post_url { "http://example.com" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/azerbaijan_bank_accounts.rb | spec/support/factories/azerbaijan_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :azerbaijan_bank_account do
user
account_number { "AZ77ADJE12345678901234567890" }
account_number_last_four { "7890" }
bank_code { "123456" }
branch_code { "123456" }
account_holder_full_name { "Azerbaijani Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/south_africa_bank_accounts.rb | spec/support/factories/south_africa_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :south_africa_bank_account do
user
account_number { "000001234" }
account_number_last_four { "0054" }
bank_code { "FIRNZAJJ" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/bahrain_bank_accounts.rb | spec/support/factories/bahrain_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :bahrain_bank_account do
user
account_number { "BH29BMAG1299123456BH00" }
account_number_last_four { "BH00" }
bank_code { "AAAABHBMXYZ" }
account_holder_full_name { "Bahrainian Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/cart_products.rb | spec/support/factories/cart_products.rb | # frozen_string_literal: true
FactoryBot.define do
factory :cart_product do
association :cart, factory: :cart
association :product, factory: :product
price { product.price_cents }
quantity { 1 }
referrer { "direct" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/computed_sales_analytics_days.rb | spec/support/factories/computed_sales_analytics_days.rb | # frozen_string_literal: true
FactoryBot.define do
factory :computed_sales_analytics_day do
sequence(:key) { |n| "key#{n}" }
data { "{}" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/jordan_bank_accounts.rb | spec/support/factories/jordan_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :jordan_bank_account do
user
account_number { "JO32ABCJ0010123456789012345678" }
account_number_last_four { "5678" }
bank_code { "AAAAJOJOXXX" }
account_holder_full_name { "Jordanian Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/discover_searches.rb | spec/support/factories/discover_searches.rb | # frozen_string_literal: true
FactoryBot.define do
factory :discover_search do
query { "entrepreneurship" }
ip_address { "127.0.0.1" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_cached_value.rb | spec/support/factories/product_cached_value.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_cached_value do
product
trait :expired do
expired { true }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/israel_bank_accounts.rb | spec/support/factories/israel_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :israel_bank_account do
user
account_number { "IL620108000000099999999" }
account_number_last_four { "9999" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/subscription_events.rb | spec/support/factories/subscription_events.rb | # frozen_string_literal: true
FactoryBot.define do
factory :subscription_event do
subscription
event_type { :deactivated }
occurred_at { Time.current }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/third_party_analytics.rb | spec/support/factories/third_party_analytics.rb | # frozen_string_literal: true
FactoryBot.define do
factory :third_party_analytic do
user
name { "Gumhead's Snippet" }
link { FactoryBot.create(:product, user:) }
analytics_code { "<script>console.log('running script')</script><noscript><img height='1' width='1' alt='' style='display:none' src='http://placehold.it/350x150' /></noscript>" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/zip_tax_rate.rb | spec/support/factories/zip_tax_rate.rb | # frozen_string_literal: true
FactoryBot.define do
factory :zip_tax_rate do
combined_rate { "0.1100000" }
county_rate { "0.0100000" }
special_rate { "0.0300000" }
state_rate { "0.0500000" }
city_rate { "0.0200000" }
state { "NY" }
zip_code { "10087" }
country { "US" }
is_seller_responsible { 1 }
is_epublication_rate { 0 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/angola_bank_accounts.rb | spec/support/factories/angola_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :angola_bank_account do
user
account_number { "AO06004400006729503010102" }
account_number_last_four { "0102" }
bank_code { "AAAAAOAOXXX" }
account_holder_full_name { "Angola Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/denmark_bank_accounts.rb | spec/support/factories/denmark_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :denmark_bank_account do
user
account_number { "DK5000400440116243" }
account_number_last_four { "2874" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/installments.rb | spec/support/factories/installments.rb | # frozen_string_literal: true
FactoryBot.define do
factory :installment, aliases: [:post] do
association :link, factory: :product
seller { link&.user }
message { Faker::Lorem.paragraph }
name { Faker::Book.title }
send_emails { true }
installment_type { "product" }
shown_on_profile { false }
deleted_at { nil }
allow_comments { true }
factory :published_installment do
published_at { Time.current }
end
trait :published do
published_at { Time.current }
end
factory :variant_post, aliases: [:variant_installment] do
installment_type { Installment::VARIANT_TYPE }
association :base_variant, factory: :variant
end
factory :product_post, aliases: [:product_installment] do
installment_type { Installment::PRODUCT_TYPE }
end
factory :seller_post, aliases: [:seller_installment] do
installment_type { Installment::SELLER_TYPE }
seller factory: :user
link { nil }
end
factory :follower_post do # follower_installment has attachments
installment_type { Installment::FOLLOWER_TYPE }
seller factory: :user
link { nil }
end
factory :affiliate_post do # affiliate_installment has attachments
installment_type { Installment::AFFILIATE_TYPE }
seller factory: :user
link { nil }
end
factory :audience_installment, aliases: [:audience_post] do
message { Faker::Lorem.paragraph }
name { Faker::Book.title }
installment_type { Installment::AUDIENCE_TYPE }
send_emails { true }
link { nil }
seller factory: :user
end
factory :scheduled_installment do
ready_to_publish { true }
after(:create) do |installment|
create(:installment_rule, installment:)
end
end
factory :workflow_installment, aliases: [:workflow_post] do
send_emails { true }
workflow { create(:product_workflow, seller:, link:) }
installment_type { workflow.workflow_type }
base_variant { workflow.base_variant }
is_for_new_customers_of_workflow { !workflow.send_to_past_customers }
published_at { workflow.published_at }
workflow_installment_published_once_already { published_at.present? }
json_data { workflow.json_data }
after(:create) do |installment|
create(:installment_rule, installment:, delayed_delivery_time: 0)
end
end
end
factory :follower_installment, class: Installment do
message { "Here is a new PDF for you" }
name { "A new file!" }
installment_type { Installment::FOLLOWER_TYPE }
send_emails { true }
link { nil }
seller factory: :user
after(:create) do |installment|
create(:product_file, installment:, url: "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/billion-dollar-company-chapter-0.pdf", link: nil)
end
end
factory :affiliate_installment, class: Installment do
message { "Here is a new PDF for you" }
name { "A new file!" }
installment_type { Installment::AFFILIATE_TYPE }
send_emails { true }
link { nil }
seller factory: :user
after(:create) do |installment|
create(:product_file, installment:, url: "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/billion-dollar-company-chapter-0.pdf", link: nil)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/pakistan_bank_accounts.rb | spec/support/factories/pakistan_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :pakistan_bank_account do
user
account_number { "PK36SCBL0000001123456702" }
account_number_last_four { "6702" }
bank_code { "AAAAPKKAXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sent_post_emails.rb | spec/support/factories/sent_post_emails.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sent_post_email do
post
email { generate(:email) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/shipping_destinations.rb | spec/support/factories/shipping_destinations.rb | # frozen_string_literal: true
FactoryBot.define do
factory :shipping_destination do
country_code { Product::Shipping::ELSEWHERE }
one_item_rate_cents { 0 }
multiple_items_rate_cents { 0 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/laos_bank_accounts.rb | spec/support/factories/laos_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :laos_bank_account do
user
account_number { "000123456789" }
account_number_last_four { "6789" }
bank_code { "AAAALALAXXX" }
account_holder_full_name { "Laos Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/hong_kong_bank_accounts.rb | spec/support/factories/hong_kong_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :hong_kong_bank_account do
user
account_number { "000123456" }
branch_code { "000" }
bank_number { "110" }
account_number_last_four { "3456" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/brunei_bank_accounts.rb | spec/support/factories/brunei_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :brunei_bank_account do
user
account_number { "0000123456789" }
account_number_last_four { "6789" }
bank_code { "AAAABNBBXXX" }
account_holder_full_name { "Brunei Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/thumbnails.rb | spec/support/factories/thumbnails.rb | # frozen_string_literal: true
FactoryBot.define do
factory :thumbnail do
product { create(:product) }
before(:create) do |thumbnail|
blob = ActiveStorage::Blob.create_and_upload!(io: Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "smilie.png"), "image/png"), filename: "smilie.png")
blob.analyze
thumbnail.file.attach(blob)
end
after(:create) do |thumbnail|
thumbnail.file.analyze if thumbnail.file.attached?
end
end
factory :unsplash_thumbnail, class: "Thumbnail" do
product { create(:product) }
unsplash_url { "https://images.unsplash.com/photo-1587502536575-6dfba0a6e017" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/ach_accounts.rb | spec/support/factories/ach_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :ach_account do
user
account_number { "1112121234" }
routing_number { "110000000" }
account_number_last_four { "1234" }
account_holder_full_name { "Gumbot Gumstein I" }
account_type { "checking" }
end
factory :ach_account_2, parent: :ach_account do
user
account_number { "2222125678" }
routing_number { "110000000" }
account_number_last_four { "5678" }
account_holder_full_name { "Gumbot Gumstein II" }
account_type { "checking" }
end
factory :ach_account_stripe_succeed, parent: :ach_account do
user
account_number { "000123456789" }
routing_number { "110000000" }
account_number_last_four { "6789" }
account_holder_full_name { "Stripe Test Account" }
account_type { "checking" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_folders.rb | spec/support/factories/product_folders.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_folder do
name { Faker::Book.title }
association :link, factory: :product
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/variants.rb | spec/support/factories/variants.rb | # frozen_string_literal: true
FactoryBot.define do
factory :variant do
variant_category
price_difference_cents { 0 }
name { Faker::Subscription.plan }
transient do
active_integrations { [] }
end
trait :with_product_file do
after(:create) do |variant|
variant.product_files << create(:product_file, link: variant.variant_category.link)
end
end
after(:create) { |variant, evaluator| variant.active_integrations |= evaluator.active_integrations }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_affiliates.rb | spec/support/factories/product_affiliates.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_affiliate do
association :product
association :affiliate, factory: :direct_affiliate
affiliate_basis_points { 1000 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/niger_bank_accounts.rb | spec/support/factories/niger_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :niger_bank_account do
user
account_number { "NE58NE0380100100130305000268" }
account_number_last_four { "0268" }
account_holder_full_name { "Niger Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/access_tokens.rb | spec/support/factories/access_tokens.rb | # frozen_string_literal: true
FactoryBot.define do
factory "doorkeeper/access_token" do
association :application, factory: :oauth_application
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_review_responses.rb | spec/support/factories/product_review_responses.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_review_response do
product_review
user { product_review.purchase.seller }
message { Faker::Lorem.paragraph }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/norway_bank_accounts.rb | spec/support/factories/norway_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :norway_bank_account do
user
account_number { "NO9386011117947" }
account_number_last_four { "7947" }
account_holder_full_name { "Norwegian Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/comment.rb | spec/support/factories/comment.rb | # frozen_string_literal: true
FactoryBot.define do
factory :comment do
association :commentable, factory: :published_installment
association :author, factory: :user
author_name { author.display_name }
comment_type { Comment::COMMENT_TYPE_USER_SUBMITTED }
content { Faker::Quote.famous_last_words }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/audience_members.rb | spec/support/factories/audience_members.rb | # frozen_string_literal: true
FactoryBot.define do
factory :audience_member do
association :seller, factory: :user
email { generate :email }
details { {} }
transient do
purchases { nil }
follower { nil }
affiliates { nil }
end
after(:build) do |member, evaluator|
if evaluator.purchases.present?
member.details[:purchases] ||= []
evaluator.purchases.each do |purchase|
purchase[:id] ||= 1
purchase[:product_id] ||= 1
purchase[:price_cents] ||= 100
purchase[:created_at] ||= 7.days.ago.iso8601
purchase[:country] ||= "United States"
member.details[:purchases] << purchase
end
end
unless evaluator.follower.nil?
follower = evaluator.follower
follower[:id] ||= 1
follower[:created_at] ||= 7.days.ago.iso8601
member.details[:follower] = follower
end
if evaluator.affiliates.present?
member.details[:affiliates] ||= []
evaluator.affiliates.each do |affiliate|
affiliate[:id] ||= 1
affiliate[:product_id] ||= 1
affiliate[:created_at] ||= 7.days.ago.iso8601
member.details[:affiliates] << affiliate
end
end
if member.details.blank?
member.details = {
follower: {
id: 1,
created_at: Time.current.iso8601
}
}
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/merchant_accounts.rb | spec/support/factories/merchant_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
sequence :merchant_account_id do |n|
n.to_s.rjust(9, "0")
end
factory :merchant_account, class: MerchantAccount do
user
charge_processor_id { StripeChargeProcessor.charge_processor_id }
charge_processor_merchant_id { generate(:merchant_account_id) }
charge_processor_alive_at { Time.current }
end
factory :merchant_account_paypal, class: MerchantAccount do
user
charge_processor_id { PaypalChargeProcessor.charge_processor_id }
charge_processor_merchant_id { generate(:merchant_account_id) }
charge_processor_alive_at { Time.current }
end
factory :merchant_account_stripe, class: MerchantAccount do
user
initialize_with do
create(:tos_agreement, user:)
create(:user_compliance_info, user:)
merchant_account = StripeMerchantAccountManager.create_account(user, passphrase: GlobalConfig.get("STRONGBOX_GENERAL_PASSWORD"))
StripeMerchantAccountHelper.upload_verification_document(merchant_account.charge_processor_merchant_id)
StripeMerchantAccountHelper.ensure_charges_enabled(merchant_account.charge_processor_merchant_id)
merchant_account
end
end
factory :merchant_account_stripe_canada, class: MerchantAccount do
user
initialize_with do
create(:tos_agreement, user:)
create(:user_compliance_info_canada, user:)
merchant_account = StripeMerchantAccountManager.create_account(user, passphrase: GlobalConfig.get("STRONGBOX_GENERAL_PASSWORD"))
StripeMerchantAccountHelper.upload_verification_document(merchant_account.charge_processor_merchant_id)
StripeMerchantAccountHelper.ensure_charges_enabled(merchant_account.charge_processor_merchant_id)
merchant_account
end
end
factory :merchant_account_stripe_korea, class: MerchantAccount do
user
initialize_with do
create(:tos_agreement, user:)
create(:user_compliance_info_korea, user:)
merchant_account = StripeMerchantAccountManager.create_account(user, passphrase: GlobalConfig.get("STRONGBOX_GENERAL_PASSWORD"))
StripeMerchantAccountHelper.upload_verification_document(merchant_account.charge_processor_merchant_id)
StripeMerchantAccountHelper.ensure_charges_enabled(merchant_account.charge_processor_merchant_id)
merchant_account
end
end
factory :merchant_account_stripe_mexico, class: MerchantAccount do
user
initialize_with do
create(:tos_agreement, user:)
create(:user_compliance_info_mex_business, user:)
merchant_account = StripeMerchantAccountManager.create_account(user, passphrase: GlobalConfig.get("STRONGBOX_GENERAL_PASSWORD"))
StripeMerchantAccountHelper.upload_verification_document(merchant_account.charge_processor_merchant_id)
StripeMerchantAccountHelper.ensure_charges_enabled(merchant_account.charge_processor_merchant_id)
merchant_account
end
end
factory :merchant_account_stripe_connect, class: MerchantAccount do
user
charge_processor_id { StripeChargeProcessor.charge_processor_id }
charge_processor_merchant_id { "acct_1SOb0DEwFhlcVS6d" }
charge_processor_alive_at { Time.current }
json_data { { "meta" => { "stripe_connect" => "true" } } }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/bhutan_bank_accounts.rb | spec/support/factories/bhutan_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :bhutan_bank_account do
user
account_number { "0000123456789" }
account_number_last_four { "6789" }
bank_code { "AAAABTBTXXX" }
account_holder_full_name { "Bhutan Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/installment_plan_snapshots.rb | spec/support/factories/installment_plan_snapshots.rb | # frozen_string_literal: true
FactoryBot.define do
factory :installment_plan_snapshot do
payment_option
number_of_installments { 3 }
recurrence { "monthly" }
total_price_cents { 14700 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/cached_sales_related_products_infos.rb | spec/support/factories/cached_sales_related_products_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :cached_sales_related_products_info do
product
counts { {} }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/credits.rb | spec/support/factories/credits.rb | # frozen_string_literal: true
FactoryBot.define do
factory :credit do
user
merchant_account
amount_cents { 1_00 }
crediting_user { create(:user) }
balance
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/qatar_bank_accounts.rb | spec/support/factories/qatar_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :qatar_bank_account do
user
account_number { "QA87CITI123456789012345678901" }
account_number_last_four { "8901" }
bank_code { "AAAAQAQAXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/yearly_stats.rb | spec/support/factories/yearly_stats.rb | # frozen_string_literal: true
FactoryBot.define do
factory :yearly_stat do
association :user, factory: :user
analytics_data { {} }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/consumption_events.rb | spec/support/factories/consumption_events.rb | # frozen_string_literal: true
FactoryBot.define do
factory :consumption_event do
product_file_id { create(:product_file).id }
url_redirect_id { create(:url_redirect).id }
purchase_id { create(:purchase).id }
link_id { create(:product).id }
event_type { ConsumptionEvent::EVENT_TYPE_WATCH }
platform { Platform::WEB }
consumed_at { Time.current }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/workflows.rb | spec/support/factories/workflows.rb | # frozen_string_literal: true
FactoryBot.define do
factory :workflow do
association :seller, factory: :user
link { create(:product, user: seller) }
name { "my workflow" }
workflow_type { "product" }
workflow_trigger { nil }
factory :audience_workflow do
workflow_type { Workflow::AUDIENCE_TYPE }
link { nil }
end
factory :seller_workflow do
workflow_type { Workflow::SELLER_TYPE }
link { nil }
end
factory :product_workflow do
workflow_type { Workflow::PRODUCT_TYPE }
end
factory :variant_workflow do
workflow_type { Workflow::VARIANT_TYPE }
association :base_variant, factory: :variant
end
factory :follower_workflow do
workflow_type { Workflow::FOLLOWER_TYPE }
link { nil }
end
factory :affiliate_workflow do
workflow_type { Workflow::AFFILIATE_TYPE }
link { nil }
end
factory :abandoned_cart_workflow do
workflow_type { Workflow::ABANDONED_CART_TYPE }
link { nil }
after(:create) do |workflow|
installment = build(:workflow_installment, workflow:, seller: workflow.seller)
installment.published_at = workflow.published_at
installment.name = "You left something in your cart"
installment.message = "When you're ready to buy, complete checking out.<product-list-placeholder />Thanks!"
installment.save!
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/recommended_purchase_infos.rb | spec/support/factories/recommended_purchase_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :recommended_purchase_info do
purchase
recommended_link { purchase.link }
factory :recommended_purchase_info_via_discover do
recommendation_type { "discover" }
end
factory :recommended_purchase_info_via_product do
recommended_by_link { FactoryBot.create(:product) }
recommendation_type { "product" }
end
factory :recommended_purchase_info_via_search do
recommendation_type { "search" }
end
factory :recommended_purchase_info_via_receipt do
recommended_by_link { FactoryBot.create(:product) }
recommendation_type { "receipt" }
end
factory :recommended_purchase_info_via_collection do
recommendation_type { "collection" }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sent_abandoned_cart_emails.rb | spec/support/factories/sent_abandoned_cart_emails.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sent_abandoned_cart_email do
cart { create(:cart) }
installment { create(:abandoned_cart_workflow, published_at: 1.day.ago).installments.first }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/early_fraud_warnings.rb | spec/support/factories/early_fraud_warnings.rb | # frozen_string_literal: true
FactoryBot.define do
factory :early_fraud_warning do
purchase
processor_id { "issfr_0O3PbF9e1RjUNIyYjsCznU4B" }
fraud_type { "made_with_stolen_card" }
charge_risk_level { "normal" }
actionable { true }
processor_created_at { 1.hour.ago }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/google_calendar_integrations.rb | spec/support/factories/google_calendar_integrations.rb | # frozen_string_literal: true
FactoryBot.define do
factory :google_calendar_integration do
calendar_id { "0" }
calendar_summary { "Holidays" }
access_token { "test_access_token" }
refresh_token { "test_refresh_token" }
email { "hi@gmail.com" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/licenses.rb | spec/support/factories/licenses.rb | # frozen_string_literal: true
FactoryBot.define do
factory :license do
association :link, factory: :product
purchase
uses { 0 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/czech_republic_bank_accounts.rb | spec/support/factories/czech_republic_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :czech_republic_bank_account do
user
account_number { "CZ6508000000192000145399" }
account_number_last_four { "3000" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/philippines_bank_accounts.rb | spec/support/factories/philippines_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :philippines_bank_account do
user
account_number { "01567890123456789" }
bank_number { "BCDEFGHI123" }
account_number_last_four { "I123" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/purchases.rb | spec/support/factories/purchases.rb | # frozen_string_literal: true
FactoryBot.define do
factory :purchase do
association :link, factory: :product
seller { link.user }
price_cents { link.price_cents }
shipping_cents { 0 }
tax_cents { 0 }
gumroad_tax_cents { 0 }
total_transaction_cents { price_cents + gumroad_tax_cents }
displayed_price_cents { price_cents - shipping_cents - tax_cents }
email { generate :email }
stripe_fingerprint { price_cents == 0 ? nil : "shfbeg5142fff" }
stripe_transaction_id { price_cents == 0 ? nil : "2763276372637263" }
card_type do
if charge_processor_id == PaypalChargeProcessor.charge_processor_id
CardType::PAYPAL
else
"visa"
end
end
card_visual do
if charge_processor_id == PaypalChargeProcessor.charge_processor_id
"jane@paypal.com"
else
"**** **** **** 4062"
end
end
card_country { "US" }
ip_address { Faker::Internet.ip_v4_address }
browser_guid { generate :browser_guid }
charge_processor_id do
if chargeable
chargeable.charge_processor_id
else
stripe_transaction_id ? StripeChargeProcessor.charge_processor_id : nil
end
end
merchant_account { stripe_transaction_id ? MerchantAccount.gumroad(charge_processor_id) : nil }
purchase_state { "successful" }
succeeded_at { Time.current }
flow_of_funds { FlowOfFunds.build_simple_flow_of_funds(Currency::USD, total_transaction_cents) }
after(:build) { |purchase| purchase.send(:calculate_fees) }
trait :with_custom_fee do
transient do
fee_cents { nil }
end
before(:create) do |purchase, evaluator|
if evaluator.fee_cents
purchase.fee_cents = evaluator.fee_cents
end
end
end
trait :with_review do
after(:create) do |purchase|
create(:product_review, purchase:, rating: 5)
end
end
trait :with_license do
after(:create) do |purchase|
create(:license, purchase:)
end
end
trait :from_seller do
link { create(:product, user: seller) }
end
trait :gift_receiver do
is_gift_receiver_purchase { true }
purchase_state { "gift_receiver_purchase_successful" }
end
trait :gift_sender do
is_gift_sender_purchase { true }
end
factory :purchase_2 do
price_cents { 20_00 }
created_at { "2012-03-22" }
stripe_fingerprint { "shfbeggg5142fff" }
stripe_transaction_id { "276322276372637263" }
end
factory :free_purchase do
price_cents { 0 }
displayed_price_cents { 0 }
card_type { nil }
card_visual { nil }
stripe_fingerprint { nil }
stripe_transaction_id { nil }
end
factory :test_purchase do
purchase_state { "in_progress" }
purchaser { link.user }
email { link.user.email }
after(:create, &:mark_test_successful!)
end
factory :preorder_authorization_purchase do
purchase_state { "preorder_authorization_successful" }
end
factory :failed_purchase do
purchase_state { "failed" }
end
factory :refunded_purchase do
stripe_refunded { true }
after(:create) do |purchase|
create(:refund, purchase:, amount_cents: purchase.price_cents)
end
end
trait :refunded do
stripe_refunded { true }
after(:create) do |purchase|
create(:refund, purchase:, amount_cents: purchase.price_cents)
end
end
factory :disputed_purchase do
chargeable { build(:chargeable_success_charge_disputed) }
chargeback_date { Time.current }
end
trait :with_dispute do
after(:create) do |purchase|
create(:dispute, purchase:)
end
end
factory :physical_purchase do
full_name { "barnabas" }
street_address { "123 barnabas street" }
city { "barnabasville" }
state { "CA" }
country { "United States" }
zip_code { "94114" }
end
factory :purchase_in_progress do
purchase_state { "in_progress" }
factory :purchase_with_balance do
after(:create, &:update_balance_and_mark_successful!)
end
end
factory :membership_purchase do
association :link, factory: :membership_product
is_original_subscription_purchase { true }
transient do
tier { nil }
end
before(:create) do |purchase, evaluator|
purchase.variant_attributes = evaluator.tier.present? ? [evaluator.tier] : purchase.tiers
end
after(:create) do |purchase, evaluator|
purchase.subscription ||= create(:subscription, link: purchase.link)
purchase.save!
if purchase.is_installment_payment && purchase.installment_plan.present?
payment_option = purchase.subscription.last_payment_option
if payment_option && !payment_option.installment_plan_snapshot
create(:installment_plan_snapshot,
payment_option: payment_option,
number_of_installments: purchase.installment_plan.number_of_installments,
recurrence: purchase.installment_plan.recurrence,
total_price_cents: purchase.total_price_before_installments || purchase.price_cents)
end
end
end
end
factory :free_trial_membership_purchase do
association :link, factory: [:membership_product, :with_free_trial_enabled]
is_original_subscription_purchase { true }
is_free_trial_purchase { true }
should_exclude_product_review { true }
purchase_state { "not_charged" }
succeeded_at { nil }
before(:create) do |purchase, evaluator|
purchase.variant_attributes = purchase.tiers
end
after(:create) do |purchase, evaluator|
purchase.subscription ||= create(:subscription, link: purchase.link, user: purchase.purchaser, free_trial_ends_at: Time.current + purchase.link.free_trial_duration)
purchase.variant_attributes = purchase.tiers
purchase.save!
if purchase.is_installment_payment && purchase.installment_plan.present?
payment_option = purchase.subscription.last_payment_option
if payment_option && !payment_option.installment_plan_snapshot
create(:installment_plan_snapshot,
payment_option: payment_option,
number_of_installments: purchase.installment_plan.number_of_installments,
recurrence: purchase.installment_plan.recurrence,
total_price_cents: purchase.total_price_before_installments || purchase.price_cents)
end
end
end
end
factory :recurring_membership_purchase do
association :link, factory: :membership_product
is_original_subscription_purchase { false }
before do
purchase.variant_attributes = purchase.tiers
end
after(:create) do |purchase|
purchase.subscription ||= create(:subscription, link: purchase.link)
purchase.subscription.purchases << build(:membership_purchase)
purchase.save!
if purchase.is_installment_payment && purchase.installment_plan.present?
payment_option = purchase.subscription.last_payment_option
if payment_option && !payment_option.installment_plan_snapshot
create(:installment_plan_snapshot,
payment_option: payment_option,
number_of_installments: purchase.installment_plan.number_of_installments,
recurrence: purchase.installment_plan.recurrence,
total_price_cents: purchase.total_price_before_installments || purchase.price_cents)
end
end
end
end
factory :installment_plan_purchase do
association :link, :with_installment_plan, factory: :product
is_original_subscription_purchase { true }
is_installment_payment { true }
before(:create) do |purchase|
purchase.installment_plan = purchase.link.installment_plan
purchase.set_price_and_rate
end
after(:create) do |purchase, evaluator|
purchase.subscription ||= create(:subscription, link: purchase.link, is_installment_plan: true, user: purchase.purchaser)
purchase.save!
if purchase.is_installment_payment && purchase.installment_plan.present?
payment_option = purchase.subscription.last_payment_option
if payment_option && !payment_option.installment_plan_snapshot
create(:installment_plan_snapshot,
payment_option: payment_option,
number_of_installments: purchase.installment_plan.number_of_installments,
recurrence: purchase.installment_plan.recurrence,
total_price_cents: purchase.total_price_before_installments || purchase.price_cents)
end
end
end
end
factory :recurring_installment_plan_purchase do
association :link, :with_installment_plan, factory: :product
is_original_subscription_purchase { false }
is_installment_payment { true }
before(:create) do |purchase|
purchase.installment_plan = purchase.link.installment_plan
purchase.set_price_and_rate
end
end
factory :call_purchase do
link { create(:call_product, :available_for_a_year) }
after(:build) do |purchase|
purchase.call ||= build(:call, purchase:)
end
end
factory :commission_deposit_purchase do
is_commission_deposit_purchase { true }
association :link, factory: :commission_product
association :credit_card
after(:build) do |purchase|
purchase.set_price_and_rate
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sales_exports.rb | spec/support/factories/sales_exports.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sales_export do
association :recipient, factory: :user
query { { "bool" => {} } }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/skus.rb | spec/support/factories/skus.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sku do
association :link, factory: :product
price_difference_cents { 0 }
name { "Large" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/large_sellers.rb | spec/support/factories/large_sellers.rb | # frozen_string_literal: true
FactoryBot.define do
factory :large_seller do
user
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/offer_codes.rb | spec/support/factories/offer_codes.rb | # frozen_string_literal: true
FactoryBot.define do
factory :offer_code do
user
products { [FactoryBot.create(:product, user:)] }
code { "sxsw" }
amount_cents { 1_00 }
currency_type { user.currency_type }
before(:create) do |offer_code|
if offer_code.products.present?
offer_code.user_id = offer_code.products.first.user_id
end
end
factory :percentage_offer_code do
products { [FactoryBot.create(:product, user:, price_cents: 2_00)] }
amount_cents { nil }
amount_percentage { 50 }
end
factory :universal_offer_code do
universal { true }
products { [] }
end
factory :cancellation_discount_offer_code do
is_cancellation_discount { true }
duration_in_billing_cycles { 3 }
products { [FactoryBot.create(:membership_product_with_preset_tiered_pricing, user:)] }
factory :fixed_cancellation_discount_offer_code do
amount_cents { 100 }
amount_percentage { nil }
end
factory :percentage_cancellation_discount_offer_code do
amount_cents { nil }
amount_percentage { 10 }
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/ethiopia_bank_accounts.rb | spec/support/factories/ethiopia_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :ethiopia_bank_account do
user
account_number { "0000000012345" }
account_number_last_four { "2345" }
bank_code { "AAAAETETXXX" }
account_holder_full_name { "Ethiopia Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/refunds.rb | spec/support/factories/refunds.rb | # frozen_string_literal: true
FactoryBot.define do
factory :refund do
purchase
refunding_user_id { create(:user).id }
total_transaction_cents { purchase.total_transaction_cents }
amount_cents { purchase.price_cents }
creator_tax_cents { purchase.tax_cents }
gumroad_tax_cents { purchase.gumroad_tax_cents }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/tanzania_bank_accounts.rb | spec/support/factories/tanzania_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :tanzania_bank_account do
user
account_number { "0000123456789" }
account_number_last_four { "6789" }
bank_code { "AAAATZTXXXX" }
account_holder_full_name { "Tanzanian Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/video_files.rb | spec/support/factories/video_files.rb | # frozen_string_literal: true
FactoryBot.define do
factory :video_file do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/ScreenRecording.mov" }
filetype { "mov" }
user { create(:user) }
record { user }
trait :with_thumbnail do
after(:build) do |video_file|
video_file.thumbnail.attach(
io: File.open(Rails.root.join("spec/support/fixtures/test-small.png")),
filename: "thumbnail.png",
content_type: "image/png"
)
end
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/user_compliance_info_requests.rb | spec/support/factories/user_compliance_info_requests.rb | # frozen_string_literal: true
FactoryBot.define do
factory :user_compliance_info_request do
user
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/tos_agreements.rb | spec/support/factories/tos_agreements.rb | # frozen_string_literal: true
FactoryBot.define do
factory :tos_agreement do
user
ip { "54.234.242.13" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/guatemala_bank_accounts.rb | spec/support/factories/guatemala_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :guatemala_bank_account do
user
account_number { "GT20AGRO00000000001234567890" }
account_number_last_four { "7890" }
bank_code { "AAAAGTGCXYZ" }
account_holder_full_name { "Guatemala Creator" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/dispute_evidences.rb | spec/support/factories/dispute_evidences.rb | # frozen_string_literal: true
FactoryBot.define do
factory :dispute_evidence do
dispute { create(:dispute_formalized) }
purchased_at { dispute.purchase.created_at }
customer_email { dispute.purchase.email }
seller_contacted_at { Time.current }
after(:create) do |dispute_evidence|
blob = ActiveStorage::Blob.create_and_upload!(io: Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "smilie.png"), "image/png"), filename: "receipt_image.png")
blob.analyze
dispute_evidence.receipt_image.attach(blob)
blob = ActiveStorage::Blob.create_and_upload!(io: Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "smilie.png"), "image/png"), filename: "refund_policy.png")
blob.analyze
dispute_evidence.refund_policy_image.attach(blob)
end
end
factory :dispute_evidence_on_charge, parent: :dispute_evidence do
dispute { create(:dispute_formalized_on_charge) }
purchased_at { dispute.charge.created_at }
customer_email { dispute.charge.purchases.last.email }
seller_contacted_at { Time.current }
after(:create) do |dispute_evidence|
blob = ActiveStorage::Blob.create_and_upload!(io: Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "smilie.png"), "image/png"), filename: "receipt_image.png")
blob.analyze
dispute_evidence.receipt_image.attach(blob)
blob = ActiveStorage::Blob.create_and_upload!(io: Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "smilie.png"), "image/png"), filename: "refund_policy.png")
blob.analyze
dispute_evidence.refund_policy_image.attach(blob)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sales_export_chunks.rb | spec/support/factories/sales_export_chunks.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sales_export_chunk do
association :export, factory: :sales_export
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/signup_events.rb | spec/support/factories/signup_events.rb | # frozen_string_literal: true
FactoryBot.define do
factory :signup_event do
event_name { "signup" }
from_profile { false }
ip_country { "United States" }
ip_state { "CA" }
after(:build) do |event|
event.referrer_domain = Referrer.extract_domain(event.referrer) if event.referrer.present?
event.referrer_domain = REFERRER_DOMAIN_FOR_GUMROAD_RECOMMENDED_PRODUCTS if event.was_product_recommended
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sent_email_infos.rb | spec/support/factories/sent_email_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sent_email_info do
key { SecureRandom.hex(20) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/backtax_agreements.rb | spec/support/factories/backtax_agreements.rb | # frozen_string_literal: true
FactoryBot.define do
factory :backtax_agreement do
user
jurisdiction { "AUSTRALIA" }
signature { "Edgar Gumstein" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/custom_domains.rb | spec/support/factories/custom_domains.rb | # frozen_string_literal: true
FactoryBot.define do
factory :custom_domain do
association :user
domain { Faker::Internet.domain_name(subdomain: true) }
end
trait :with_product do
association :product
user { nil }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/rich_content.rb | spec/support/factories/rich_content.rb | # frozen_string_literal: true
FactoryBot.define do
factory :rich_content do
association :entity, factory: :product
description { [] }
factory :product_rich_content do
association :entity, factory: :product
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/seller_profile_subscribe_sections.rb | spec/support/factories/seller_profile_subscribe_sections.rb | # frozen_string_literal: true
FactoryBot.define do
factory :seller_profile_subscribe_section do
seller { create(:user) }
header { "Subscribe to me!" }
button_label { "Subscribe" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/bahamas_bank_accounts.rb | spec/support/factories/bahamas_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :bahamas_bank_account do
user
account_number { "0001234" }
account_number_last_four { "1234" }
bank_code { "AAAABSNSXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/sales_related_products_infos.rb | spec/support/factories/sales_related_products_infos.rb | # frozen_string_literal: true
FactoryBot.define do
factory :sales_related_products_info do
smaller_product { create(:product) }
larger_product { create(:product) }
sales_count { 1 }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/stamped_pdfs.rb | spec/support/factories/stamped_pdfs.rb | # frozen_string_literal: true
FactoryBot.define do
factory :stamped_pdf do
url_redirect
product_file
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/attachment/manual_stamped.pdf" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/indian_bank_accounts.rb | spec/support/factories/indian_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :indian_bank_account do
user
account_number { "000123456789" }
account_number_last_four { "6789" }
ifsc { "HDFC0004051" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/namibia_bank_accounts.rb | spec/support/factories/namibia_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :namibia_bank_account do
user
account_number { "000123456789" }
account_number_last_four { "6789" }
bank_code { "AAAANANXXYZ" }
account_holder_full_name { "Namibia Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_refund_policies.rb | spec/support/factories/product_refund_policies.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_refund_policy do
product
seller { product.user }
max_refund_period_in_days { RefundPolicy::DEFAULT_REFUND_PERIOD_IN_DAYS }
fine_print { "This is a product-level refund policy" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/affiliate_partial_refunds.rb | spec/support/factories/affiliate_partial_refunds.rb | # frozen_string_literal: true
FactoryBot.define do
factory :affiliate_partial_refund do
affiliate_credit
affiliate_user { affiliate_credit.affiliate_user }
seller { affiliate_credit.seller }
purchase { affiliate_credit.purchase }
affiliate { affiliate_credit.affiliate }
balance
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/madagascar_bank_accounts.rb | spec/support/factories/madagascar_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :madagascar_bank_account do
user
account_number { "MG4800005000011234567890123" }
account_number_last_four { "0123" }
bank_code { "AAAAMGMGXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/product_files.rb | spec/support/factories/product_files.rb | # frozen_string_literal: true
FactoryBot.define do
factory :product_file do
association :link, factory: :product
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/#{SecureRandom.hex}.pdf" }
trait :analyze do
after(:create) { |file| file.analyze }
end
factory :external_link do
url { "https://www.gumroad.com" }
filetype { "link" }
filegroup { "url" }
end
factory :streamable_video do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/ScreenRecording.mov" }
filetype { "mov" }
filegroup { "video" }
end
factory :non_streamable_video do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/ScreenRecording.mpg" }
filetype { "mpg" }
filegroup { "url" }
end
factory :listenable_audio do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/magic.mp3" }
filetype { "mp3" }
filegroup { "audio" }
end
factory :non_listenable_audio do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/test-with-tags.aiff" }
filetype { "aiff" }
filegroup { "url" }
end
factory :readable_document, aliases: [:pdf_product_file] do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/billion-dollar-company-chapter-0.pdf" }
filetype { "pdf" }
filegroup { "document" }
end
factory :non_readable_document, aliases: [:epub_product_file] do
url { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/test.epub" }
filetype { "epub" }
filegroup { "epub_document" }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/nigeria_bank_accounts.rb | spec/support/factories/nigeria_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :nigeria_bank_account do
user
account_number { "1111111112" }
account_number_last_four { "1112" }
bank_code { "AAAANGLAXXX" }
account_holder_full_name { "Nigerian Creator I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/asset_previews.rb | spec/support/factories/asset_previews.rb | # frozen_string_literal: true
FactoryBot.define do
factory :asset_preview do
association :link, factory: :product
transient do
attach { true }
end
before(:create) do |preview, evaluator|
preview.file.attach Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "kFDzu.png"), "image/png") if evaluator.attach
end
factory :asset_preview_mov do
before(:create) do |preview, evaluator|
preview.file.attach Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "thing.mov"), "video/quicktime") if evaluator.attach
end
end
factory :asset_preview_jpg do
before(:create) do |preview, evaluator|
preview.file.attach Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "test-small.jpg"), "image/jpeg") if evaluator.attach
end
end
factory :asset_preview_gif do
before(:create) do |preview, evaluator|
preview.file.attach Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", "sample.gif"), "image/gif") if evaluator.attach
end
end
factory :asset_preview_youtube do
attach { false }
oembed do
{
"html" =>
"<iframe width=\"356\" height=\"200\" src=\"https://www.youtube.com/embed/qKebcV1jv3A?feature=oembed&showinfo=0&controls=0&rel=0\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>",
"info" =>
{
"height" => 200,
"width" => 356,
"thumbnail_url" => "https://i.ytimg.com/vi/qKebcV1jv3A/hqdefault.jpg"
}
}
end
end
after(:create) do |preview|
preview.file.analyze if preview.file.attached?
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/support/factories/algeria_bank_accounts.rb | spec/support/factories/algeria_bank_accounts.rb | # frozen_string_literal: true
FactoryBot.define do
factory :algeria_bank_account do
user
account_number { "00001234567890123456" }
account_number_last_four { "3456" }
bank_code { "AAAADZDZXXX" }
account_holder_full_name { "Gumbot Gumstein I" }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.