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/sidekiq/duplicate_product_worker_spec.rb
spec/sidekiq/duplicate_product_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe DuplicateProductWorker do describe "#perform" do before do @product = create(:product, name: "test product") end it "duplicates product successfully" do expect { described_class.new.perform(@product.id) }.to change(Link, :count).b...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_user_balance_stats_cache_worker_spec.rb
spec/sidekiq/update_user_balance_stats_cache_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe UpdateUserBalanceStatsCacheWorker do describe "#perform" do it "writes cache" do user = create(:user) expect(UserBalanceStatsService.new(user:).send(:read_cache)).to eq(nil) described_class.new.perform(user.id) expect(UserBalan...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/stamp_pdf_for_purchase_job_spec.rb
spec/sidekiq/stamp_pdf_for_purchase_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe StampPdfForPurchaseJob do let(:seller) { create(:named_seller) } let(:product) { create(:product, user: seller) } let(:purchase) { create(:purchase, link: product, seller: seller) } before do allow(PdfStampingService).to receive(:stamp_for_purc...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/cancel_subscriptions_for_product_worker_spec.rb
spec/sidekiq/cancel_subscriptions_for_product_worker_spec.rb
# frozen_string_literal: true describe CancelSubscriptionsForProductWorker do describe "#perform" do before do @product = create(:membership_product, subscription_duration: "monthly", deleted_at: 1.day.ago) @subscription = create(:subscription, link: @product) @product.subscriptions << @subscri...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/perform_payouts_up_to_delay_days_ago_worker_spec.rb
spec/sidekiq/perform_payouts_up_to_delay_days_ago_worker_spec.rb
# frozen_string_literal: true describe PerformPayoutsUpToDelayDaysAgoWorker do describe "perform" do let(:payout_period_end_date) { User::PayoutSchedule.next_scheduled_payout_end_date } let(:payout_processor_type) { PayoutProcessorType::PAYPAL } it "calls 'create_payments_for_balances_up_to_date' on 'Pa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/stripe_transfer_gumroads_available_balances_to_gumroads_bank_account_worker_spec.rb
spec/sidekiq/stripe_transfer_gumroads_available_balances_to_gumroads_bank_account_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeTransferGumroadsAvailableBalancesToGumroadsBankAccountWorker, :vcr do include StripeChargesHelper describe "#perform" do let(:estimate_held_amount_cents) { { HolderOfFunds::GUMROAD => 30_000_00, HolderOfFunds::STRIPE => 20_000_00 } } bef...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_to_elasticsearch_worker_spec.rb
spec/sidekiq/send_to_elasticsearch_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe SendToElasticsearchWorker do before do @product = create(:product) @product_double = double("product") end it "attempts to index the product in Elasticsearch when instructed" do expect(Link).to receive(:find_by).with(id: @product.id) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/generate_ssl_certificate_spec.rb
spec/sidekiq/generate_ssl_certificate_spec.rb
# frozen_string_literal: true describe GenerateSslCertificate do describe "#perform" do before do @custom_domain = create(:custom_domain, domain: "www.example.com") @obj_double = double("SslCertificates::Generate object") allow(SslCertificates::Generate).to receive(:new).with(@custom_domain).an...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_cached_sales_related_products_infos_job_spec.rb
spec/sidekiq/update_cached_sales_related_products_infos_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe UpdateCachedSalesRelatedProductsInfosJob do describe "#perform" do before do Feature.activate(:update_sales_related_products_infos) end let(:product) { create(:product) } let(:product_2) { create(:product) } let(:product_3) { cr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/handle_stripe_event_worker_spec.rb
spec/sidekiq/handle_stripe_event_worker_spec.rb
# frozen_string_literal: true describe HandleStripeEventWorker do describe "perform" do describe "stripe_connect_account_id is not provided" do it "calls the StripeEventHandler" do id = rand(10_000).to_s expect_any_instance_of(StripeEventHandler).to receive(:handle_stripe_event) exp...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/perform_daily_instant_payouts_worker_spec.rb
spec/sidekiq/perform_daily_instant_payouts_worker_spec.rb
# frozen_string_literal: true describe PerformDailyInstantPayoutsWorker do describe "perform" do let(:payout_period_end_date) { Date.yesterday } it "calls 'create_instant_payouts_for_balances_up_to_date' on 'Payouts' which will do all the work" do expect(Payouts).to receive(:create_instant_payouts_for...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/elasticsearch_indexer_worker_spec.rb
spec/sidekiq/elasticsearch_indexer_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe ElasticsearchIndexerWorker, :elasticsearch_wait_for_refresh do describe "#perform without ActiveRecord objects" do before do class TravelEvent include Elasticsearch::Model index_name "test_travel_events" end EsClient....
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_utm_link_stats_job_spec.rb
spec/sidekiq/update_utm_link_stats_job_spec.rb
# frozen_string_literal: true describe UpdateUtmLinkStatsJob do describe "#perform" do let(:utm_link) { create(:utm_link) } let!(:utm_link_visit1) { create(:utm_link_visit, utm_link:, browser_guid: "abc123") } let!(:utm_link_visit2) { create(:utm_link_visit, utm_link:, browser_guid: "def456") } let!(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/purge_old_deleted_asset_previews_worker_spec.rb
spec/sidekiq/purge_old_deleted_asset_previews_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe PurgeOldDeletedAssetPreviewsWorker do describe "#perform" do it "deletes targeted rows" do stub_const("#{described_class}::DELETION_BATCH_SIZE", 1) create(:asset_preview, deleted_at: 2.months.ago) recently_marked_as_deleted = create(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/retry_failed_paypal_payouts_worker_spec.rb
spec/sidekiq/retry_failed_paypal_payouts_worker_spec.rb
# frozen_string_literal: true describe RetryFailedPaypalPayoutsWorker do describe "perform" do it "calls `Payouts.create_payments_for_balances_up_to_date_for_users`" do payout_period_end_date = User::PayoutSchedule.manual_payout_end_date failed_payment = create(:payment_failed, user: create(:user), p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/refund_purchase_worker_spec.rb
spec/sidekiq/refund_purchase_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe RefundPurchaseWorker do describe "#perform" do let(:admin_user) { create(:admin_user) } let(:purchase) { create(:purchase) } let(:purchase_double) { double } before do expect(Purchase).to receive(:find).with(purchase.id).and_return(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_payout_status_worker_spec.rb
spec/sidekiq/update_payout_status_worker_spec.rb
# frozen_string_literal: true describe UpdatePayoutStatusWorker do describe "#perform" do context "when the payout is not created in the split mode" do let(:payment) { create(:payment, processor_fee_cents: 10, txn_id: "Some ID") } it "fetches and sets the new payment status from PayPal" do e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/process_early_fraud_warning_job_spec.rb
spec/sidekiq/process_early_fraud_warning_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe ProcessEarlyFraudWarningJob, :vcr do let(:purchase) { create(:purchase, stripe_transaction_id: "ch_2O8n7J9e1RjUNIyY1rs9MIRL") } let!(:early_fraud_warning) { create(:early_fraud_warning, purchase:) } describe "#perform" do context "when the disput...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/activate_integrations_worker_spec.rb
spec/sidekiq/activate_integrations_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe ActivateIntegrationsWorker do it "calls CircleIntegrationService#activate" do purchase = create(:purchase) expect_any_instance_of(Integrations::CircleIntegrationService).to receive(:activate).with(purchase) described_class.new.perform(purchas...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_vat_report_job_spec.rb
spec/sidekiq/create_vat_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateVatReportJob do it "raises an ArgumentError if the year is less than 2014 or greater than 3200" do expect do described_class.new.perform(2, 2013) end.to raise_error(ArgumentError) end it "raises an ArgumentError if the quarter is ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/expire_stamped_pdfs_job_spec.rb
spec/sidekiq/expire_stamped_pdfs_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe ExpireStampedPdfsJob do describe "#perform" do it "marks old stamped pdfs as deleted" do record_1 = create(:stamped_pdf, created_at: 1.year.ago) record_2 = create(:stamped_pdf, created_at: 1.day.ago) described_class.new.perform ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_preorder_seller_summary_worker_spec.rb
spec/sidekiq/send_preorder_seller_summary_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe SendPreorderSellerSummaryWorker, :vcr do before do travel_to 2.days.ago @product = create(:product, price_cents: 600, is_in_preorder_state: false) @preorder_product = create(:preorder_product_with_content, link: @product, release_at: 2.days.fr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/handle_new_user_compliance_info_worker_spec.rb
spec/sidekiq/handle_new_user_compliance_info_worker_spec.rb
# frozen_string_literal: true describe HandleNewUserComplianceInfoWorker do describe "perform" do let(:user_compliance_info) { create(:user_compliance_info) } it "calls StripeMerchantAccountManager.handle_new_user_compliance_info with the user compliance info object" do expect(StripeMerchantAccountMan...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/refund_unpaid_purchases_worker_spec.rb
spec/sidekiq/refund_unpaid_purchases_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe RefundUnpaidPurchasesWorker, :vcr do describe "#perform" do before do @admin_user = create(:admin_user) @purchase = create(:purchase_in_progress, chargeable: create(:chargeable)) @purchase.process! @purchase.mark_successful! ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_last_post_job_spec.rb
spec/sidekiq/send_last_post_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe SendLastPostJob do describe "#perform" do let(:product) { create(:membership_product) } let(:tier) { product.default_tier } let(:purchase) { create(:membership_purchase, link: product, seller: product.user, tier:) } let(:recipient) { { ema...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/publish_scheduled_post_job_spec.rb
spec/sidekiq/publish_scheduled_post_job_spec.rb
# frozen_string_literal: true describe PublishScheduledPostJob, :freeze_time do before do @post = create(:audience_installment, shown_on_profile: true, send_emails: true) @rule = create(:installment_rule, installment: @post) end describe "#perform" do it "publishes post, creates a blast and enqueues...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_stripe_apple_pay_domain_worker_spec.rb
spec/sidekiq/create_stripe_apple_pay_domain_worker_spec.rb
# frozen_string_literal: true describe CreateStripeApplePayDomainWorker, :vcr do describe "#perform" do before do @user = create(:user, username: "sampleusername") allow(Subdomain).to receive(:from_username).and_return("sampleusername.gumroad.dev") allow(Rails.env).to receive(:test?).and_return...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/reindex_user_elasticsearch_data_worker_spec.rb
spec/sidekiq/reindex_user_elasticsearch_data_worker_spec.rb
# frozen_string_literal: true describe ReindexUserElasticsearchDataWorker do it "reindexes ES data for user" do user = create(:user) admin = create(:admin_user) allow(DevTools).to receive(:reindex_all_for_user).and_return(nil) expect(DevTools).to receive(:reindex_all_for_user).with(user.id) desc...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/generate_sales_report_job_spec.rb
spec/sidekiq/generate_sales_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe GenerateSalesReportJob do let (:country_code) { "GB" } let(:start_date) { Date.new(2015, 1, 1) } let (:end_date) { Date.new(2015, 3, 31) } it "raises an argument error if the country code is not valid" do expect { described_class.new.perform("A...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_reminders_for_outstanding_user_compliance_info_requests_worker_spec.rb
spec/sidekiq/send_reminders_for_outstanding_user_compliance_info_requests_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe SendRemindersForOutstandingUserComplianceInfoRequestsWorker do describe "#perform" do let(:user_1) { create(:user) } let(:user_2) { create(:user) } let(:user_3) { create(:user) } let(:user_4) { create(:user) } let(:user_5) { create(:us...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_installment_events_count_cache_worker_spec.rb
spec/sidekiq/update_installment_events_count_cache_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe UpdateInstallmentEventsCountCacheWorker do describe "#perform" do it "calculates and caches the correct installment_events count" do installment = create(:installment) create_list(:installment_event, 2, installment:) UpdateInstallmen...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/renew_facebook_access_tokens_worker_spec.rb
spec/sidekiq/renew_facebook_access_tokens_worker_spec.rb
# frozen_string_literal: true describe RenewFacebookAccessTokensWorker do describe "#perform" do before do @oauth = double "oauth" allow(Koala::Facebook::OAuth).to receive(:new).and_return @oauth end it "renews tokens for accounts with tokens updated < 30 days ago" do create(:user, upd...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/schedule_membership_price_updates_job_spec.rb
spec/sidekiq/schedule_membership_price_updates_job_spec.rb
# frozen_string_literal: true describe ScheduleMembershipPriceUpdatesJob do describe "perform" do context "for a non-tiered membership variant" do it "does nothing" do variant = create(:variant) purchase = create(:purchase, variant_attributes: [variant]) create(:subscription, origin...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_missing_purchase_events_worker_spec.rb
spec/sidekiq/create_missing_purchase_events_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateMissingPurchaseEventsWorker do let!(:purchase) do create(:purchase, created_at: 1.day.ago, ip_country: "United States", ip_state: "CA") do |purchase| purchase.seller.update!(timezone: "UTC") end end it "creates the missing event a...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/delete_old_sent_email_info_records_job_spec.rb
spec/sidekiq/delete_old_sent_email_info_records_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe DeleteOldSentEmailInfoRecordsJob do describe "#perform" do it "deletes targeted rows" do create(:sent_email_info, created_at: 3.years.ago) create(:sent_email_info, created_at: 2.years.ago) create(:sent_email_info, created_at: 6.month...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/set_subscription_as_deactivated_worker_spec.rb
spec/sidekiq/set_subscription_as_deactivated_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe SetSubscriptionAsDeactivatedWorker do describe "#perform" do it "sets subscription as deactivated" do product = create(:membership_product) purchase = create(:membership_purchase, link: product) subscription = purchase.subscription ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/check_payment_address_worker_spec.rb
spec/sidekiq/check_payment_address_worker_spec.rb
# frozen_string_literal: true describe CheckPaymentAddressWorker do before do @previously_banned_user = create(:user, user_risk_state: "suspended_for_fraud", payment_address: "tuhins@gmail.com") @blocked_email_object = BlockedObject.block!(BLOCKED_OBJECT_TYPES[:email], "fraudulent_email@zombo.com", nil) en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/generate_canada_sales_report_job_spec.rb
spec/sidekiq/generate_canada_sales_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe GenerateCanadaSalesReportJob do let(:month) { 8 } let(:year) { 2022 } it "raises an argument error if the year is out of bounds" do expect { described_class.new.perform(month, 2013) }.to raise_error(ArgumentError) end it "raises an agrument ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/regenerate_creator_analytics_cache_worker_spec.rb
spec/sidekiq/regenerate_creator_analytics_cache_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe RegenerateCreatorAnalyticsCacheWorker do describe "#perform" do it "runs CreatorAnalytics::CachingProxy#overwrite_cache" do user = create(:user) service_object = double("CreatorAnalytics::CachingProxy object") expect(CreatorAnalytic...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_us_state_monthly_sales_reports_job_spec.rb
spec/sidekiq/create_us_state_monthly_sales_reports_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateUsStateMonthlySalesReportsJob do let (:subdivision_code) { "WA" } let(:month) { 8 } let (:year) { 2022 } it "raises an argument error if the year is out of bounds" do expect { described_class.new.perform(subdivision_code, month, 2013) }.t...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_canada_monthly_sales_report_job_spec.rb
spec/sidekiq/create_canada_monthly_sales_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateCanadaMonthlySalesReportJob do let(:month) { 1 } let(:year) { 2015 } it "raises an argument error if the year is out of bounds" do expect { described_class.new.perform(month, 2013) }.to raise_error(ArgumentError) end it "raises an agru...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/exports/audience_export_worker_spec.rb
spec/sidekiq/exports/audience_export_worker_spec.rb
# frozen_string_literal: true describe Exports::AudienceExportWorker do describe "#perform" do let(:seller) { create(:user) } let(:audience_options) { { followers: true } } let(:recipient) { create(:user) } before do ActionMailer::Base.deliveries.clear end it "sends email to seller wh...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/exports/affiliate_export_worker_spec.rb
spec/sidekiq/exports/affiliate_export_worker_spec.rb
# frozen_string_literal: true describe Exports::AffiliateExportWorker do describe "#perform" do before do @seller = create(:user) ActionMailer::Base.deliveries.clear end it "sends email to seller when it is also the recipient" do expect(ContactingCreatorMailer).to receive(:affiliates_d...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/exports/sales/compile_chunks_worker_spec.rb
spec/sidekiq/exports/sales/compile_chunks_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe Exports::Sales::CompileChunksWorker do before do @worker = described_class.new # Check the tests of UsersController#export_sales for the complete overall behavior, # what the email sent contains, with which custom fields, etc. @csv_tempfil...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/exports/sales/create_and_enqueue_chunks_worker_spec.rb
spec/sidekiq/exports/sales/create_and_enqueue_chunks_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe Exports::Sales::CreateAndEnqueueChunksWorker do before do seller = create(:user) product = create(:product, user: seller) @purchases = create_list(:purchase, 3, link: product) @export = create(:sales_export, query: PurchaseSearchService.ne...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/exports/sales/process_chunk_worker_spec.rb
spec/sidekiq/exports/sales/process_chunk_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe Exports::Sales::ProcessChunkWorker do before do @worker = described_class.new # Check the tests of UsersController#export_sales for the complete overall behavior, # what the email sent contains, with which custom fields, etc. @csv_tempfile...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/reports/generate_ytd_sales_report_job_spec.rb
spec/sidekiq/reports/generate_ytd_sales_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe Reports::GenerateYtdSalesReportJob do let(:job) { described_class.new } let(:es_results_double) { double("Elasticsearch::Persistence::Repository::Response::Results") } let(:mailer_double) { double("ActionMailer::MessageDelivery", deliver_now: true) } ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/onetime/generate_subscribe_previews_spec.rb
spec/sidekiq/onetime/generate_subscribe_previews_spec.rb
# frozen_string_literal: true require "spec_helper" describe Onetime::GenerateSubscribePreviews do let(:users) { create_list(:user, 2) } let(:user_ids) { users.map(&:id) } describe "#perform" do context "when subscribe preview generation succeeds" do it "attaches the generated image to the user and e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/iffy/event_job_spec.rb
spec/sidekiq/iffy/event_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe Iffy::EventJob do describe "#perform" do let(:id) { 1 } let(:entity) { "Product" } context "when event is valid" do Iffy::EventJob::EVENTS.each do |event| it "calls the appropriate service for #{event}" do service_clas...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/iffy/product/ingest_job_spec.rb
spec/sidekiq/iffy/product/ingest_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe Iffy::Product::IngestJob do describe "#perform" do let(:product) { create(:product) } it "invokes the ingest service with the correct product" do expect(Iffy::Product::IngestService).to receive(:new).with(product).and_call_original ex...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/iffy/profile/ingest_job_spec.rb
spec/sidekiq/iffy/profile/ingest_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe Iffy::Profile::IngestJob do describe "#perform" do let(:user) { create(:user) } it "invokes the ingest service with the correct user" do expect(Iffy::Profile::IngestService).to receive(:new).with(user).and_call_original expect_any_ins...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/iffy/post/ingest_job_spec.rb
spec/sidekiq/iffy/post/ingest_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe Iffy::Post::IngestJob do describe "#perform" do let(:installment) { create(:installment) } it "invokes the ingest service with the correct installment" do expect(Iffy::Post::IngestService).to receive(:new).with(installment).and_call_origina...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/affiliate_mailer_spec.rb
spec/mailers/affiliate_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe AffiliateMailer do describe "#notify_affiliate_of_sale" do let(:seller) { create(:named_user) } let(:product_name) { "Affiliated Product" } let(:purchaser_email) { generate(:email) } shared_examples "notifies affiliate of a sale" do ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/team_mailer_spec.rb
spec/mailers/team_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe TeamMailer do let(:seller) { create(:named_seller) } describe "#invite" do let(:email) { "member@example.com" } let(:team_invitation) { create(:team_invitation, seller:, email:) } subject(:mail) { described_class.invite(team_invitation) } ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/invite_mailer_spec.rb
spec/mailers/invite_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe InviteMailer do describe "receiver_signed_up" do before do @user = create(:user) @invite = create(:invite, sender_id: @user.id) @invited_user = create(:user, email: @invite.receiver_email) @invited_user.mark_as_invited(@user.ex...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/two_factor_authentication_mailer_spec.rb
spec/mailers/two_factor_authentication_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe TwoFactorAuthenticationMailer do let(:user) { create :user } describe "#authentication_token" do before do @mail = TwoFactorAuthenticationMailer.authentication_token(user.id) end it "has has all required information" do expect(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/comment_mailer_spec.rb
spec/mailers/comment_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe CommentMailer do describe "notify_seller_of_new_comment" do let(:comment) { create(:comment, content: "Their -> they're") } subject(:mail) { described_class.notify_seller_of_new_comment(comment.id) } it "emails to seller" do expect(mail...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/application_mailer_spec.rb
spec/mailers/application_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe ApplicationMailer do it "includes RescueSmtpErrors" do expect(described_class).to include(RescueSmtpErrors) end describe "delivery method" do let(:mailer) { described_class.new } before do described_class.class_eval do def ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/affiliate_request_mailer_spec.rb
spec/mailers/affiliate_request_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe AffiliateRequestMailer do let(:requester_email) { "requester@example.com" } let(:creator) { create(:named_user) } let(:affiliate_request) { create(:affiliate_request, email: requester_email, seller: creator) } describe "notify_requester_of_request_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/community_chat_recap_mailer_spec.rb
spec/mailers/community_chat_recap_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe CommunityChatRecapMailer do describe "community_chat_recap_notification" do let(:user) { create(:user) } let(:seller) { create(:user, name: "John Doe") } let(:product) { create(:product, user: seller, name: "Snap app") } let!(:community) {...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/user_signup_mailer_spec.rb
spec/mailers/user_signup_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe UserSignupMailer do it "includes RescueSmtpErrors" do expect(described_class).to include(RescueSmtpErrors) end describe "#confirmation_instructions" do before do user = create(:user) @mail = described_class.confirmation_instructio...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/service_mailer_spec.rb
spec/mailers/service_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe ServiceMailer do before do @user = create(:user) @black_recurring_service = create(:black_recurring_service, user: @user) end describe "service_charge_receipt" do it "renders properly" do service_charge = create(:service_charge, use...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/contacting_creator_mailer_spec.rb
spec/mailers/contacting_creator_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe ContactingCreatorMailer do let(:custom_mailer_route_helper) do Class.new(ActionMailer::Base) do include CustomMailerRouteBuilder end.new end it "uses SUPPORT_EMAIL_WITH_NAME as default from address" do expect(described_class.default...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/follower_mailer_spec.rb
spec/mailers/follower_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe FollowerMailer do describe "#confirm_follower" do let(:followee) { create(:user) } let(:unconfirmed_follower) { create(:follower, user: followee) } it "sends email to follower to confirm the follow" do mail = FollowerMailer.confirm_foll...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/accounting_mailer_spec.rb
spec/mailers/accounting_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe AccountingMailer, :vcr do describe "#vat_report" do let(:dummy_s3_link) { "https://test_vat_link.at.s3" } before do @mail = AccountingMailer.vat_report(3, 2015, dummy_s3_link) end it "has the s3 link in the body" do expect(@m...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/admin_mailer_spec.rb
spec/mailers/admin_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe AdminMailer do describe "#chargeback_notify" do context "for a dispute on Purchase" do let!(:purchase) { create(:purchase) } let!(:dispute) { create(:dispute_formalized, purchase:) } let!(:mail) { described_class.chargeback_notify(di...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/merchant_registration_mailer_spec.rb
spec/mailers/merchant_registration_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe MerchantRegistrationMailer do describe "#account_deauthorized_to_user" do let(:user) { create(:user) } let(:user_id) { user.id } let(:charge_processor_id) { StripeChargeProcessor.charge_processor_id } let(:mail) do described_class.a...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/creator_mailer_spec.rb
spec/mailers/creator_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreatorMailer do describe "#gumroad_day_fee_saved" do it "includes details of fee saved on Gumroad day" do seller = create(:user, gumroad_day_timezone: "Mumbai") create(:purchase, price_cents: 40620, link: create(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/customer_low_priority_mailer_spec.rb
spec/mailers/customer_low_priority_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe CustomerLowPriorityMailer do describe "subscription_autocancelled" do context "memberships" do before do @product = create(:subscription_product, name: "fan club") @subscription = create(:subscription, link: @product) @pu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/customer_mailer_spec.rb
spec/mailers/customer_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe CustomerMailer do describe "receipt" do subject(:mail) do user = create(:user, email: "bob@gumroad.com", name: "bob walsh") link = create(:product, user:) @purchase = create(:purchase, link:, seller: link.user, email: "to@example.or...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/one_off_mailer_spec.rb
spec/mailers/one_off_mailer_spec.rb
# frozen_string_literal: true require "spec_helper" describe OneOffMailer do let(:email) { "seller@example.com" } let(:reply_to) { ApplicationMailer::NOREPLY_EMAIL_WITH_NAME } describe "#email" do let(:subject) { "Email subject" } let(:body) { "Email body" } it "doesn't send attempt to email if bo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/concerns/rescue_smtp_errors_spec.rb
spec/mailers/concerns/rescue_smtp_errors_spec.rb
# frozen_string_literal: true require "spec_helper" describe RescueSmtpErrors do let(:mailer_class) do Class.new(ActionMailer::Base) do include RescueSmtpErrors def welcome # We need a body to not render views mail(from: "foo@bar.com", body: "") end end end describe "...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/mailers/concerns/custom_mailer_route_builder_spec.rb
spec/mailers/concerns/custom_mailer_route_builder_spec.rb
# frozen_string_literal: true require "spec_helper" describe CustomMailerRouteBuilder do let(:mailer_class) do Class.new(ActionMailer::Base) do include CustomMailerRouteBuilder end end before do @mail = mailer_class.new @user = create(:user, username: "creatordude") @post = create(:in...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/channels/community_channel_spec.rb
spec/channels/community_channel_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe CommunityChannel do let(:user) { create(:user) } let(:seller) { create(:user) } let(:product) { create(:product, community_chat_enabled: true, user: seller) } let!(:community) { create(:community, seller: seller, resource: product) } before...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/channels/connection_spec.rb
spec/channels/connection_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe ApplicationCable::Connection, type: :channel do let!(:user) { create(:user) } let!(:gumroad_admin_user) { create(:user, is_team_member: true) } let!(:impersonated_user) { create(:user) } def connect_with_user(user) if user session =...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/channels/user_channel_spec.rb
spec/channels/user_channel_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe UserChannel do let(:user) { create(:user) } let(:seller) { create(:user) } let(:product) { create(:product, community_chat_enabled: true, user: seller) } let!(:community) { create(:community, seller: seller, resource: product) } before do ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/product_custom_domain_constraint.rb
lib/product_custom_domain_constraint.rb
# frozen_string_literal: true class ProductCustomDomainConstraint def self.matches?(request) CustomDomain.find_by_host(request.host)&.product.present? end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/custom_rouge_theme.rb
lib/custom_rouge_theme.rb
# frozen_string_literal: true # Overrides the 'bg0' pallete of Rouge's Gruvbox light theme # https://github.com/rouge-ruby/rouge/blob/43d346cceb1123510de67ec58a2fa1e29d22cc7b/lib/rouge/themes/gruvbox.rb class CustomRougeTheme < Rouge::Themes::Gruvbox def self.make_light! super palette bg0: "#fff" end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/api_domain_constraint.rb
lib/api_domain_constraint.rb
# frozen_string_literal: true class ApiDomainConstraint def self.matches?(request) Rails.env.development? || VALID_API_REQUEST_HOSTS.include?(request.host) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/discover_domain_constraint.rb
lib/discover_domain_constraint.rb
# frozen_string_literal: true class DiscoverDomainConstraint def self.matches?(request) request.host == VALID_DISCOVER_REQUEST_HOST end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/catch_bad_request_errors.rb
lib/catch_bad_request_errors.rb
# frozen_string_literal: true class CatchBadRequestErrors def initialize(app) @app = app end def call(env) @app.call(env) rescue ActionController::BadRequest if env["HTTP_ACCEPT"].include?("application/json") [400, { "Content-Type" => "application/json" }, [{ success: false }.to_json]] e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/user_custom_domain_constraint.rb
lib/user_custom_domain_constraint.rb
# frozen_string_literal: true class UserCustomDomainConstraint def self.matches?(request) Subdomain.find_seller_by_request(request).present? || CustomDomain.find_by_host(request.host)&.user&.username.present? || SubdomainRedirectorService.new.redirect_url_for(request).present? end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/discover_taxonomy_constraint.rb
lib/discover_taxonomy_constraint.rb
# frozen_string_literal: true class DiscoverTaxonomyConstraint def self.matches?(request) valid_taxonomy_paths.include?(request.path) end def self.valid_taxonomy_paths @valid_taxonomy_paths ||= Taxonomy.eager_load(:self_and_ancestors) .order("taxonomy_hierarchies.ge...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/gumroad_domain_constraint.rb
lib/gumroad_domain_constraint.rb
# frozen_string_literal: true class GumroadDomainConstraint def self.matches?(request) VALID_REQUEST_HOSTS.include?(request.host) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/errors/gumroad_runtime_error.rb
lib/errors/gumroad_runtime_error.rb
# frozen_string_literal: true class GumroadRuntimeError < RuntimeError def initialize(message = nil, original_error: nil) super(message || original_error) set_backtrace(original_error.backtrace) if original_error end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/validators/hex_color_validator.rb
lib/validators/hex_color_validator.rb
# frozen_string_literal: true class HexColorValidator < ActiveModel::EachValidator HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/i def validate_each(record, attribute, value) return if self.class.matches?(value) record.errors.add(attribute, (options[:message] || "is not a valid hexadecimal color")) end def self...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/sidekiq_utility.rb
lib/utilities/sidekiq_utility.rb
# frozen_string_literal: true class SidekiqUtility INSTANCE_ID_ENDPOINT = "http://169.254.169.254/latest/meta-data/instance-id" def initialize @process_set = Sidekiq::ProcessSet.new graceful_shutdown_timeout = ENV.fetch("SIDEKIQ_GRACEFUL_SHUTDOWN_TIMEOUT", 4).to_i.hours @timeout_at = Time.current + g...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/ffprobe.rb
lib/utilities/ffprobe.rb
# frozen_string_literal: true class Ffprobe attr_reader :path def initialize(path) @path = File.expand_path(path) end def parse raise ArgumentError, "File not found #{path}" unless File.exist?(path) OpenStruct.new(first_stream) end private def calculate_framerate(r_frame_rate) rfr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/d3.rb
lib/utilities/d3.rb
# frozen_string_literal: true ## # A collection of D3 related helper methods. ## class D3 class << self def formatted_date(date, today_date: Date.today) date == today_date ? "Today" : date.strftime("%b %e, %Y") end def formatted_date_with_timezone(time, timezone) today_date = Time.current.i...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/xml_helpers.rb
lib/utilities/xml_helpers.rb
# frozen_string_literal: true # Public: Helper functions for working with the built in REXML parser. module XmlHelpers # Public: Gets the text contained within the element at the given # xpath, and given a root element. The root element may be any # XML element and does not need to be the root of the document as...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/global_config.rb
lib/utilities/global_config.rb
# frozen_string_literal: true # GlobalConfig provides a centralized way to access environment variables and Rails credentials class GlobalConfig class << self # Retrieve a value by its name from environment variables or Rails credentials # @param name [String] The name of the environment variable # @para...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/replica_lag_watcher.rb
lib/utilities/replica_lag_watcher.rb
# frozen_string_literal: true ## Will check replicas for lag every second, and sleep for a few seconds if they are. # # Typical usage: # Model.find_each do |record| # ReplicaLagWatcher.watch # record.update!(field: new_value) # end # Try to not update/delete more than ~1000 rows at once between checks, # o...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/us_zip_codes.rb
lib/utilities/us_zip_codes.rb
# frozen_string_literal: true module UsZipCodes # Given a zip code in the United States, identifies the state code. # 5-digit zip codes are supported. # Zip+4 is also supported, but only the first 5 digits are used to determine the state. # Accepts surrounding whitespace. Accepts a single whitespace or hyphen ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/feature.rb
lib/utilities/feature.rb
# frozen_string_literal: true module Feature extend self def activate(feature_name) Flipper.enable(feature_name) end def activate_user(feature_name, user) Flipper.enable_actor(feature_name, user) end def deactivate(feature_name) Flipper.disable(feature_name) end def deactivate_user(feat...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/dev_tools.rb
lib/utilities/dev_tools.rb
# frozen_string_literal: true class DevTools class << self # Useful in admin for the same reasons as `delete_all_indices_and_reindex_all`, but when you # don't want to index *everything* because you're connected to a copy of the production DB, # which has too many records for that to be practical. de...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/referrer.rb
lib/utilities/referrer.rb
# frozen_string_literal: true class Referrer DEFAULT_VALUE = "direct" def self.extract_domain(url) return DEFAULT_VALUE if url.blank? || url == "direct" domain = begin url = URI::DEFAULT_PARSER.unescape(url) url.encode!("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "") ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/compliance.rb
lib/utilities/compliance.rb
# frozen_string_literal: true module Compliance module Countries ISO3166::Country.all.each do |country| self.const_set(country.alpha3, country) end def self.mapping ISO3166::Country.all.to_h { |country| [country.alpha2, country.common_name] } end def self.find_by_name(country_name) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/geo_ip.rb
lib/utilities/geo_ip.rb
# frozen_string_literal: true module GeoIp class Result attr_reader :country_name, :country_code, :region_name, :city_name, :postal_code, :latitude, :longitude def initialize(country_name:, country_code:, region_name:, city_name:, postal_code:, latitude:, longitude:) @country_name = country_name ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/o_embed_finder.rb
lib/utilities/o_embed_finder.rb
# frozen_string_literal: true class OEmbedFinder SOUNDCLOUD_PARAMS = %w[auto_play show_artwork show_comments buying sharing download show_playcount show_user liking].freeze # limited oembed urls for mobile (we don't know if mobile can support other urls) MOBILE_URL_REGEXES = [%r{player.vimeo.com/video/\d+}, %r{...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/text_scrubber.rb
lib/utilities/text_scrubber.rb
# frozen_string_literal: true class TextScrubber def self.format(text, opts = {}) Loofah.fragment(text).to_text(opts).strip end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false