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/business/payments/integrations/paypal_partner_rest_credentials_spec.rb
spec/business/payments/integrations/paypal_partner_rest_credentials_spec.rb
# frozen_string_literal: true describe PaypalPartnerRestCredentials do describe "#auth_token" do context "when a cached token is present" do before do @some_auth_token = "random token" allow_any_instance_of(described_class).to receive(:load_token).and_return(@some_auth_token) end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/merchant_registration/stripe/stripe_merchant_account_manager_spec.rb
spec/business/payments/merchant_registration/stripe/stripe_merchant_account_manager_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeMerchantAccountManager, :vcr do include StripeMerchantAccountHelper API_VERSION = Stripe.api_version let(:user) { create(:user, unpaid_balance_cents: 10, email: "chuck@gum.com", username: "chuck") } describe "#create_account" do describ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/merchant_registration/paypal/paypal_merchant_account_manager_spec.rb
spec/business/payments/merchant_registration/paypal/paypal_merchant_account_manager_spec.rb
# frozen_string_literal: true describe PaypalMerchantAccountManager, :vcr do describe "#create_partner_referral" do let(:user) { create(:user) } context "when partner referral request is successful" do before do @response = described_class.new.create_partner_referral(user, "http://redirecturl....
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/charge_shared_examples.rb
spec/business/payments/charging/charge_shared_examples.rb
# frozen_string_literal: true require "spec_helper" shared_examples "a base processor charge" do describe "#[]" do before do subject.id = "charge-id" end it "gives access to getting attributes" do expect(subject[:id]).to eq("charge-id") end end describe "#flow_of_funds" do it "...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/chargeable_protocol.rb
spec/business/payments/charging/chargeable_protocol.rb
# frozen_string_literal: true require "spec_helper" # A chargeable is anything that can be used to charge a credit card for a purchase, subscription, etc. It should be # immutable except when the prepare function is called. This protocol is designed to be backed by any other object or # remote system (i.e. a charge p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/charge_refund_shared_examples.rb
spec/business/payments/charging/charge_refund_shared_examples.rb
# frozen_string_literal: true require "spec_helper" shared_examples "a charge refund" do describe "#flow_of_funds" do it "has a flow of funds" do expect(subject.flow_of_funds).to be_present end it "has a flow of funds with a issued amount" do expect(subject.flow_of_funds.issued_amount).to b...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/chargeable_visual_spec.rb
spec/business/payments/charging/chargeable_visual_spec.rb
# frozen_string_literal: true require "spec_helper" describe ChargeableVisual do describe "is_cc_visual" do describe "visual is a credit card" do let(:visual) { "**** **** **** 4242" } it "returns true" do expect(described_class.is_cc_visual(visual)).to eq(true) end end descr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/charge_refund_spec.rb
spec/business/payments/charging/charge_refund_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/charge_refund_shared_examples" describe ChargeRefund do let(:flow_of_funds) { FlowOfFunds.build_simple_flow_of_funds(Currency::USD, 1_00) } let(:subject) do charge_refund = ChargeRefund.new charge_refund.flow_of_funds...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/base_processor_charge_spec.rb
spec/business/payments/charging/base_processor_charge_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/charge_shared_examples" describe BaseProcessorCharge do let(:flow_of_funds) { FlowOfFunds.build_simple_flow_of_funds(Currency::USD, 1_00) } let(:subject) do charge = BaseProcessorCharge.new charge.flow_of_funds = flow...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/charge_processor_spec.rb
spec/business/payments/charging/charge_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe ChargeProcessor do describe ".get_chargeable_for_params" do it "calls get_chargeable_for_params on the charge processors" do expect_any_instance_of(StripeChargeProcessor).to receive(:get_chargeable_for_params).with({ param: "param" }, nil) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/chargeable_spec.rb
spec/business/payments/charging/chargeable_spec.rb
# frozen_string_literal: true require "spec_helper" describe Chargeable do let(:internal_chargeable_1) { double(charge_processor_id: "stripe") } let(:internal_chargeable_2) { double(charge_processor_id: "braintree") } let(:chargeable) { Chargeable.new([internal_chargeable_1, internal_chargeable_2]) } describ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/flow_of_funds_spec.rb
spec/business/payments/charging/flow_of_funds_spec.rb
# frozen_string_literal: true require "spec_helper" describe FlowOfFunds do describe ".build_simple_flow_of_funds" do let(:currency) { Currency::USD } let(:amount_cents) { 100_00 } let(:flow_of_funds) { described_class.build_simple_flow_of_funds(currency, amount_cents) } it "returns a flow of funds...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_charge_intent_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_charge_intent_spec.rb
# frozen_string_literal: true require "spec_helper" describe BraintreeChargeIntent do let(:braintree_charge) { double } subject (:braintree_charge_intent) { described_class.new(charge: braintree_charge) } describe "#succeeded?" do it "returns true" do expect(braintree_charge_intent.succeeded?).to eq...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_charge_refund_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_charge_refund_spec.rb
# frozen_string_literal: true require "spec_helper" describe BraintreeChargeRefund, :vcr do let(:braintree_chargeable) do chargeable = BraintreeChargeableNonce.new(Braintree::Test::Nonce::PayPalFuturePayment, nil) chargeable.prepare! Chargeable.new([chargeable]) end let(:braintree_charge) do pa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_charge_processor_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_charge_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe BraintreeChargeProcessor, :vcr do describe ".charge_processor_id" do it "returns 'stripe'" do expect(BraintreeChargeProcessor.charge_processor_id).to eq "braintree" end end let(:braintree_chargeable) do chargeable = BraintreeChargea...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_chargeable_nonce_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_chargeable_nonce_spec.rb
# frozen_string_literal: true require "spec_helper" describe BraintreeChargeableNonce, :vcr do describe "#prepare!" do it "throws a validation failure on using an invalid chargeable" do expect do chargeable = BraintreeChargeableNonce.new("invalid", nil) chargeable.prepare! end.to rai...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_charge_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_charge_spec.rb
# frozen_string_literal: true require "spec_helper" describe BraintreeCharge, :vcr do describe "charge without fingerprint or card details" do before do chargeable_element = BraintreeChargeableNonce.new(Braintree::Test::Nonce::PayPalFuturePayment, nil) chargeable_element.prepare! params = { ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/braintree/braintree_chargeable_transient_customer_spec.rb
spec/business/payments/charging/implementations/braintree/braintree_chargeable_transient_customer_spec.rb
# frozen_string_literal: true describe BraintreeChargeableTransientCustomer, :vcr do let(:transient_customer_store_key) { "transient-customer-token-key" } describe "tokenize_nonce_to_transient_customer" do it "stores the customer id with an expiry in redis" do frozen_time = Time.current travel_to(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_charge_intent_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_charge_intent_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeChargeIntent, :vcr do include StripeChargesHelper let(:processor_payment_intent) do create_stripe_payment_intent(StripePaymentMethodHelper.success.to_stripejs_payment_method_id, amount: 1_00, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_charge_processor_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_charge_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeChargeProcessor, :vcr do include CurrencyHelper include StripeMerchantAccountHelper include StripeChargesHelper describe ".charge_processor_id" do it "is 'stripe'" do expect(described_class.charge_processor_id).to eq "stripe" en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples.rb
spec/business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples.rb
# frozen_string_literal: true require "spec_helper" shared_examples_for "stripe chargeable common" do describe "#charge_processor_id" do it "returns 'stripe'" do expect(chargeable.charge_processor_id).to eq "stripe" end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_setup_intent_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_setup_intent_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeSetupIntent, :vcr do include StripeChargesHelper let(:processor_setup_intent) { create_stripe_setup_intent(StripePaymentMethodHelper.success.to_stripejs_payment_method_id) } subject (:stripe_setup_intent) { described_class.new(processor_setup_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_charge_radar_processor_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_charge_radar_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeChargeRadarProcessor, :vcr do describe "#handle_event" do let(:purchase) { create(:purchase) } shared_examples_for "purchase doesn't exist without Stripe Connect" do context "when not in production environment" do it "does not...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_charge_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_charge_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/charge_shared_examples" describe StripeCharge, :vcr do include StripeMerchantAccountHelper include StripeChargesHelper let(:currency) { Currency::USD } let(:amount_cents) { 1_00 } let(:stripe_charge) do stripe_cha...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_chargeable_credit_card_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_chargeable_credit_card_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/chargeable_protocol" require "business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples" describe StripeChargeableCreditCard, :vcr do let(:user) { create(:user) } let(:original_chargeable) { bu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_charge_refund_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_charge_refund_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeChargeRefund, :vcr do include StripeMerchantAccountHelper include StripeChargesHelper let(:currency) { Currency::USD } let(:amount_cents) { 1_00 } let(:stripe_charge) do create_stripe_charge(StripePaymentMethodHelper.success.to_stripe...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_chargeable_token_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_chargeable_token_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/chargeable_protocol" require "business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples" describe StripeChargeableToken, :vcr do let(:number) { "4242 4242 4242 4242" } let(:expiry_month) { 12 }...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/stripe/stripe_chargeable_payment_method_spec.rb
spec/business/payments/charging/implementations/stripe/stripe_chargeable_payment_method_spec.rb
# frozen_string_literal: true require "spec_helper" require "business/payments/charging/chargeable_protocol" require "business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples" describe StripeChargeablePaymentMethod, :vcr do let(:number) { "4242 4242 4242 4242" } let(:expiry_month...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_charge_intent_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_charge_intent_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalChargeIntent do let(:paypal_charge) { double } subject (:paypal_charge_intent) { described_class.new(charge: paypal_charge) } describe "#succeeded?" do it "returns true" do expect(paypal_charge_intent.succeeded?).to eq(true) end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_charge_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_charge_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalCharge do context "when order api is used" do context "when paypal transaction is present" do let(:order_details) do { "id" => "426572068V1934255", "intent" => "CAPTURE", "purchase_units" => [ ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_charge_refund_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_charge_refund_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalChargeRefund, :vcr do let(:paypal_api) { PayPal::SDK::Merchant::API.new } let(:pre_prepared_paypal_charge_id) do # A USD$5 charge, pre-made on Paypal. "58409660Y47347418" end let(:paypal_refund_response) do refund_request = paypa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_order_refund_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_order_refund_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalOrderRefund do describe ".new" do it "sets attributes correctly" do refund_response_double = double allow(refund_response_double).to receive(:id).and_return("ExampleID") order_refund = described_class.new(refund_response_doubl...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_charge_processor_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_charge_processor_spec.rb
# frozen_string_literal: true require "spec_helper" # The VCRs for this charge processor are recorded from manually setup scenarios # DO NOT delete VCRs in case you are re-recording en masse # # Steps to setup an express checkout to record a VCR our of: # - Create a product (non recurring charge, non pre order) local...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_approved_order_chargeable_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_approved_order_chargeable_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalApprovedOrderChargeable do let(:paypal_approved_order_chargeable) { PaypalApprovedOrderChargeable.new("9J862133JL8076730", "paypal-gr-integspecs@gumroad.com", "US") } it "returns customer paypal email for #email, paypal order id for #fingerprint,...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_rest_api_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_rest_api_spec.rb
# frozen_string_literal: true describe PaypalRestApi, :vcr do let(:api_object) { PaypalRestApi.new } let(:paypal_auth_token) { "Bearer A21AAI6Qq9kon0Z2N7R6ed3OXwkNxFraroKppGHWHJUU5w-MlQBKKcZd_WlHbQJgh79HLaWQmEnRyj3GZdRW9FMqRbbSkcmBA" } # Business accounts from our sandbox setup and their merchant IDs generated ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_chargeable_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_chargeable_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalChargeable do let(:paypal_chargeable) { PaypalChargeable.new("B-38D505255T217912K", "paypal-gr-integspecs@gumroad.com", "US") } it "returns customer paypal email for #email, billing agreement id for #fingerprint, and nil #last4" do expect(pay...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/charging/implementations/paypal/paypal_card_fingerprint_spec.rb
spec/business/payments/charging/implementations/paypal/paypal_card_fingerprint_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalCardFingerprint do describe "build_paypal_fingerprint" do describe "paypal account has an email address" do let(:email) { "jane.doe@gmail.com" } it "forms a fingerprint using the email" do expect(subject.build_paypal_fingerp...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/events/stripe/stripe_event_handler_spec.rb
spec/business/payments/events/stripe/stripe_event_handler_spec.rb
# frozen_string_literal: true describe StripeEventHandler do let(:event_id) { "evt_eventid" } describe "error handling", :vcr do context "when staging environment" do before do allow(Rails.env).to receive(:staging?).and_return(true) end it "silences errors" do expect { Strip...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/events/paypal/paypal_event_handler_spec.rb
spec/business/payments/events/paypal/paypal_event_handler_spec.rb
# frozen_string_literal: true describe PaypalEventHandler do describe "#schedule_paypal_event_processing" do context "when event is from paypal orders API" do PaypalEventType::ORDER_API_EVENTS.each do |event_type| before do @event_info = { "event_type" => event_type } end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/transfers/stripe/stripe_transfer_externally_to_gumroad_spec.rb
spec/business/payments/transfers/stripe/stripe_transfer_externally_to_gumroad_spec.rb
# frozen_string_literal: true describe StripeTransferExternallyToGumroad, :vcr do include StripeChargesHelper describe "available balances" do let(:available_balances) { described_class.available_balances } before do # ensure the available balance has positive value create_stripe_charge(Stripe...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/transfers/stripe/stripe_transfer_internally_to_creator_spec.rb
spec/business/payments/transfers/stripe/stripe_transfer_internally_to_creator_spec.rb
# frozen_string_literal: true describe StripeTransferInternallyToCreator, :vcr do include StripeMerchantAccountHelper include StripeChargesHelper describe "transfer_funds_to_account" do before do # ensure the available balance has positive value create_stripe_charge(StripePaymentMethodHelper.suc...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/utilities/stripe_url_spec.rb
spec/business/payments/utilities/stripe_url_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeUrl do describe "dashboard_url" do describe "production" do before do allow(Rails.env).to receive(:production?).and_return(true) end after do allow(Rails.env).to receive(:production?).and_call_original en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/utilities/stripe_metadata_spec.rb
spec/business/payments/utilities/stripe_metadata_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripeMetadata do describe "build_metadata_large_list" do let(:key) { "myKey" } let(:items) { %w[asdfasdf asdfasdfasdfasdf] } it "returns a key-value pair hash of items" do expect(subject.build_metadata_large_list(items, key:)).to eq( ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/sales_tax/sales_tax_calculation_spec.rb
spec/business/sales_tax/sales_tax_calculation_spec.rb
# frozen_string_literal: true require "spec_helper" describe SalesTaxCalculation do it "returns a valid object for the zero tax helper" do taxation_info = SalesTaxCalculation.zero_tax(100) expect(taxation_info.price_cents).to eq(100) expect(taxation_info.tax_cents).to eq(0) expect(taxation_info.zip...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/sales_tax/sales_tax_calculator_spec.rb
spec/business/sales_tax/sales_tax_calculator_spec.rb
# frozen_string_literal: true require "spec_helper" describe SalesTaxCalculator do describe "input validation" do it "only accepts a hash for buyer location info" do expect do SalesTaxCalculator.new(product: create(:product), price_cents: 100, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/sales_tax/taxjar/taxjar_api_spec.rb
spec/business/sales_tax/taxjar/taxjar_api_spec.rb
# frozen_string_literal: true require "spec_helper" describe TaxjarApi, :vcr do let(:origin) do { country: "US", state: "CA", zip: "94104" } end let(:destination) do { country: "US", state: "CA", zip: "94107" } end let(:nexus_address) do { coun...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/card_data_handling/card_data_handling_mode_spec.rb
spec/business/card_data_handling/card_data_handling_mode_spec.rb
# frozen_string_literal: true require "spec_helper" describe CardDataHandlingMode do it "has the correct value for modes" do expect(CardDataHandlingMode::TOKENIZE_VIA_STRIPEJS).to eq "stripejs.0" end it "has the correct valid modes" do expect(CardDataHandlingMode::VALID_MODES).to include("stripejs.0") ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/card_data_handling/card_data_handling_error_spec.rb
spec/business/card_data_handling/card_data_handling_error_spec.rb
# frozen_string_literal: true require "spec_helper" describe CardDataHandlingError do describe "with message" do let(:subject) { CardDataHandlingError.new("the-error-message") } it "message should be accessible" do expect(subject.error_message).to eq "the-error-message" end it "card error co...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/discover_domain_constraint_spec.rb
spec/lib/discover_domain_constraint_spec.rb
# frozen_string_literal: true require "spec_helper" describe DiscoverDomainConstraint do describe ".matches?" do before do @discover_domain_request = double("request") allow(@discover_domain_request).to receive(:host).and_return("discover.gumroad.com") @non_discover_domain_request = double("r...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/user_custom_domain_constraint_spec.rb
spec/lib/user_custom_domain_constraint_spec.rb
# frozen_string_literal: true require "spec_helper" describe UserCustomDomainConstraint do describe ".matches?" do context "when request doesn't come from subdomain or custom domain" do before do @gumroad_domain_request = double("request") allow(@gumroad_domain_request).to receive(:host).a...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/gumroad_domain_constraint_spec.rb
spec/lib/gumroad_domain_constraint_spec.rb
# frozen_string_literal: true require "spec_helper" describe GumroadDomainConstraint do describe ".matches?" do before do @gumroad_domain_request = double("request") allow(@gumroad_domain_request).to receive(:host).and_return("gumroad.com") @non_gumroad_domain_request = double("request") ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/product_custom_domain_constraint_spec.rb
spec/lib/product_custom_domain_constraint_spec.rb
# frozen_string_literal: true require "spec_helper" describe ProductCustomDomainConstraint do describe ".matches?" do context "when request host is a user custom domain" do before do @custom_domain_request = double("request") allow(@custom_domain_request).to receive(:host).and_return("exam...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/api_domain_constraint_spec.rb
spec/lib/api_domain_constraint_spec.rb
# frozen_string_literal: true require "spec_helper" describe ApiDomainConstraint do describe ".matches?" do before do @api_domain_request = double("request") allow(@api_domain_request).to receive(:host).and_return("api.gumroad.com") @non_api_domain_request = double("request") allow(@non...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/js_error_reporter_spec.rb
spec/lib/js_error_reporter_spec.rb
# frozen_string_literal: true require "spec_helper" describe JSErrorReporter do before(:all) do options = Selenium::WebDriver::Chrome::Options.new.tap do |opts| opts.add_argument("--headless=new") opts.add_argument("--disable-gpu") opts.add_argument("--no-sandbox") opts.add_argument("--d...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/errors/gumroad_runtime_error_spec.rb
spec/lib/errors/gumroad_runtime_error_spec.rb
# frozen_string_literal: true require "spec_helper" describe GumroadRuntimeError do describe "without message or original error" do before do raise GumroadRuntimeError rescue GumroadRuntimeError => error @error = error end it "has the default message" do expect(@error.message).to ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/d3_spec.rb
spec/lib/utilities/d3_spec.rb
# frozen_string_literal: true require "spec_helper" describe D3 do describe ".formatted_date" do it "returns 'Today' if date is today" do expect(described_class.formatted_date(Date.today)).to eq("Today") expect(described_class.formatted_date(Date.yesterday)).not_to eq("Today") expect(described...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/with_max_execution_time_spec.rb
spec/lib/utilities/with_max_execution_time_spec.rb
# frozen_string_literal: true require "spec_helper" describe WithMaxExecutionTime do describe ".timeout_queries" do it "raises Timeout error if query took longer than allowed" do # Note: MySQL max_execution_time ignores SLEEP(), so we have to manufacture a real slow query. create(:user) slow_q...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/credit_card_utility_spec.rb
spec/lib/utilities/credit_card_utility_spec.rb
# frozen_string_literal: true describe "#extract_month_and_year" do before do @expiry_date = "05 / 15" end describe "valid expiry_date" do it "extracts the month and year from a date" do expiry_month, expiry_year = CreditCardUtility.extract_month_and_year(@expiry_date) expect(expiry_month).t...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/referrer_spec.rb
spec/lib/utilities/referrer_spec.rb
# frozen_string_literal: true require "spec_helper" describe Referrer do describe ".extract_domain" do it "extracts domain from url" do expect(Referrer.extract_domain("http://twitter.com/ads")).to eq "twitter.com" end it "returns direct if url is invalid" do allow(URI).to receive(:parse).an...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/global_config_spec.rb
spec/lib/utilities/global_config_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe GlobalConfig do describe ".get" do context "when the environment variable is set" do it "returns the value of the environment variable" do allow(ENV).to receive(:fetch).with("TEST_VAR", anything).and_return("test_value") ex...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/xml_helpers_spec.rb
spec/lib/utilities/xml_helpers_spec.rb
# frozen_string_literal: true describe XmlHelpers do describe "text_at_xpath" do describe "simple xml" do let(:xml_raw) { %(<?xml version="1.0" encoding="utf-8"?><root><element>the text</element></root>) } let(:xml_document) { REXML::Document.new(xml_raw) } it "gets the text of the element" do...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/us_zip_codes_spec.rb
spec/lib/utilities/us_zip_codes_spec.rb
# frozen_string_literal: true require "spec_helper" describe UsZipCodes do describe "#identify_state_code" do it "returns the state for a zip code that exists" do expect(UsZipCodes.identify_state_code("94104")).to eq("CA") end it "returns the state for a zip code with space in front" do exp...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/compliance_spec.rb
spec/lib/utilities/compliance_spec.rb
# frozen_string_literal: true require "spec_helper" describe Compliance do describe Countries do describe ".mapping" do it "returns a Hash of country codes to countries" do expect(Compliance::Countries.mapping).to eq(mapping_expected) end end describe ".find_by_name" do it "re...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/replica_lag_watcher_spec.rb
spec/lib/utilities/replica_lag_watcher_spec.rb
# frozen_string_literal: true require "spec_helper" describe ReplicaLagWatcher do after do Thread.current["ReplicaLagWatcher.connections"] = nil Thread.current["ReplicaLagWatcher.last_checked_at"] = nil end describe ".watch" do it "sleeps if a replica is lagging" do stub_const("REPLICAS_HOSTS...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/o_embed_finder_spec.rb
spec/lib/utilities/o_embed_finder_spec.rb
# frozen_string_literal: true require "spec_helper" describe OEmbedFinder do describe "#embeddable_from_url" do before :each do expect(OEmbed::Providers).to receive(:register_all) end it "returns nil if there is an exceptions when getting oembed" do allow(OEmbed::Providers).to receive(:get)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/dev_tools_spec.rb
spec/lib/utilities/dev_tools_spec.rb
# frozen_string_literal: true require "spec_helper" describe DevTools do # Very basic tests just to guard for basic runtime errors (method not found, etc). describe ".reindex_all_for_user" do it "succeeds after indexing at least one record" do product = create(:product) Link.__elasticsearch__.crea...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/sidekiq_utility_spec.rb
spec/lib/utilities/sidekiq_utility_spec.rb
# frozen_string_literal: true require "spec_helper" describe SidekiqUtility do before do ENV["SIDEKIQ_GRACEFUL_SHUTDOWN_TIMEOUT"] = "3" ENV["SIDEKIQ_LIFECYCLE_HOOK_NAME"] = "sample_hook_name" ENV["SIDEKIQ_ASG_NAME"] = "sample_asg_name" uri_double = double("uri_double") allow(URI).to receive(:pa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/text_scrubber_spec.rb
spec/lib/utilities/text_scrubber_spec.rb
# frozen_string_literal: true require "spec_helper" describe TextScrubber do describe "#format" do it "strips HTML tags and retain the spaces between paragraphs." do text = " <h1>Hello world!</h1><p>I'm a \n\n text.<br>More text!</p> " expect(TextScrubber.format(text)).to eq "Hello world!\n\nI'm a...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/geo_ip_spec.rb
spec/lib/utilities/geo_ip_spec.rb
# frozen_string_literal: true require "spec_helper" describe GeoIp do describe ".lookup" do let(:result) { described_class.lookup(ip) } describe "an IP to location match is not possible" do let(:ip) { "127.0.0.1" } it "returns a nil result" do expect(result).to eq(nil) end en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/ffprobe_spec.rb
spec/lib/utilities/ffprobe_spec.rb
# frozen_string_literal: true require "spec_helper" describe Ffprobe do describe "#parse" do context "when a valid movie file is supplied" do let(:ffprobe_parsed) do Ffprobe.new(fixture_file_upload("sample.mov")).parse end expected_ffprobe_data = { bit_rate: "27506", d...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/utilities/feature_spec.rb
spec/lib/utilities/feature_spec.rb
# frozen_string_literal: true RSpec.describe Feature do let(:user1) { create(:user) } let(:user2) { create(:user) } let(:feature_name) { :new_feature } describe "#activate" do it "activates the feature for everyone" do expect do described_class.activate(feature_name) end.to change { Fl...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/lib/extras/bugsnag_handle_sidekiq_retries_callback_spec.rb
spec/lib/extras/bugsnag_handle_sidekiq_retries_callback_spec.rb
# frozen_string_literal: true require "spec_helper" describe "BugsnagHandleSidekiqRetriesCallback" do before do @callback = BugsnagHandleSidekiqRetriesCallback end it "ignores report when it is not the last job run attempt" do report = double(meta_data: { sidekiq: { msg: { "retry" => 1 } } }) expec...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/config/mysql_missing_table_handler_spec.rb
spec/config/mysql_missing_table_handler_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "MySQL missing table handler" do it "retries query if table is missing" do client = ActiveRecord::Base.connection_db_config .configuration_hash .slice(*%i[host username password database port socket encoding]) .then { |conf| My...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/config/rendering_extension_spec.rb
spec/config/rendering_extension_spec.rb
# frozen_string_literal: true require "spec_helper" describe "RenderingExtension" do describe "#custom_context" do let(:pundit_user) { SellerContext.new(user:, seller:) } let(:stubbed_view_context) { StubbedViewContext.new(pundit_user) } let(:custom_context) { RenderingExtension.custom_context(stubbed_v...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/generate_fees_by_creator_location_report_job_spec.rb
spec/sidekiq/generate_fees_by_creator_location_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe GenerateFeesByCreatorLocationReportJob 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...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/update_currencies_worker_spec.rb
spec/sidekiq/update_currencies_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe UpdateCurrenciesWorker, :vcr do describe "#perform" do before do @worker_instance = described_class.new end it "updates currencies for current date" do @worker_instance.currency_namespace.set("AUD", "0.1111") expect(@worker_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/sync_stuck_purchases_job_spec.rb
spec/sidekiq/sync_stuck_purchases_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe SyncStuckPurchasesJob, :vcr do describe "#perform" do let(:product) { create(:product) } before do stub_const("GUMROAD_ADMIN_ID", create(:admin_user).id) end it "does not sync any purchases if there are none in progress" do cr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/order_review_reminder_job_spec.rb
spec/sidekiq/order_review_reminder_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe OrderReviewReminderJob do let(:order) { create(:order) } let(:eligible_purchase) { create(:purchase, order: order) } let(:ineligible_purchase) { create(:purchase, order: order) } before do allow(Order).to receive(:find).with(order.id).and_retur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/handle_sendgrid_event_job_spec.rb
spec/sidekiq/handle_sendgrid_event_job_spec.rb
# frozen_string_literal: true describe HandleSendgridEventJob do describe ".perform" do context "when the event type is not supported" do let(:params) do { "_json" => [ { "event" => "processed", "type" => "CustomerMailer.receipt", "ide...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/handle_payout_reversed_worker_spec.rb
spec/sidekiq/handle_payout_reversed_worker_spec.rb
# frozen_string_literal: true describe HandlePayoutReversedWorker do describe "#perform" do let(:payment) { create(:payment) } let(:reversing_payout_id) { "reversing-payout-id" } let(:stripe_account_id) { "stripe-account-id" } let(:reversing_payout_status) { raise "define `reversing_payout_status`" ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/post_to_ping_endpoints_worker_spec.rb
spec/sidekiq/post_to_ping_endpoints_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe PostToPingEndpointsWorker, :vcr do before do @user = create(:user, notification_endpoint: "http://notification.com") @product = create(:product, user: @user, unique_permalink: "Iqw", price_cents: 500) @default_params = lambda do |purchase| ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/remove_deleted_files_from_s3_job_spec.rb
spec/sidekiq/remove_deleted_files_from_s3_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe RemoveDeletedFilesFromS3Job do before do allow_any_instance_of(described_class).to receive(:delete_s3_objects!) end it "removes recently deleted files from S3" do product_file = create(:product_file, deleted_at: 26.hours.ago) product_file...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/renew_custom_domain_ssl_certificates_spec.rb
spec/sidekiq/renew_custom_domain_ssl_certificates_spec.rb
# frozen_string_literal: true describe RenewCustomDomainSslCertificates do describe "#perform" do before do @obj_double = double("SslCertificates::Renew object") allow(SslCertificates::Renew).to receive(:new).and_return(@obj_double) allow(@obj_double).to receive(:process) end context "...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/google_calendar_invite_job_spec.rb
spec/sidekiq/google_calendar_invite_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe GoogleCalendarInviteJob do describe "#perform" do let(:call) { create(:call) } let(:link) { call.link } let(:buyer_email) { "buyer@example.com" } let(:google_calendar_integration) { create(:google_calendar_integration) } let(:gcal_api)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/large_sellers_update_user_balance_stats_cache_worker_spec.rb
spec/sidekiq/large_sellers_update_user_balance_stats_cache_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe LargeSellersUpdateUserBalanceStatsCacheWorker do describe "#perform" do it "queues a job for each cacheable user" do ids = create_list(:user, 2).map(&:id) expect(UserBalanceStatsService).to receive(:cacheable_users).and_return(User.where(i...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/delete_product_files_archives_worker_spec.rb
spec/sidekiq/delete_product_files_archives_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe DeleteProductFilesArchivesWorker do before do @product = create(:product, user: create(:named_seller)) product_file_1 = create(:product_file, link: @product) product_file_2 = create(:product_file, link: @product) product_file_3 = create(:p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_community_chat_recap_notifications_job_spec.rb
spec/sidekiq/send_community_chat_recap_notifications_job_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe SendCommunityChatRecapNotificationsJob do let(:job) { described_class.new } describe "#perform" do let(:recap_run) { create(:community_chat_recap_run) } let(:seller) { create(:user) } let(:product) { create(:product, user: seller, com...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/refresh_sitemap_monthly_worker_spec.rb
spec/sidekiq/refresh_sitemap_monthly_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe RefreshSitemapMonthlyWorker do describe "#perform" do it "enqueues jobs to generate sitemaps for products updated in last month" do product_1 = create(:product, created_at: 3.months.ago, updated_at: 1.month.ago) product_2 = create(:product...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/free_trial_expiring_reminder_worker_spec.rb
spec/sidekiq/free_trial_expiring_reminder_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe FreeTrialExpiringReminderWorker, :vcr do let(:purchase) { create(:free_trial_membership_purchase) } let(:subscription) { purchase.subscription } it "sends an email if the subscription is currently in a free trial" do expect do described_cla...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/generate_financial_reports_for_previous_month_job_spec.rb
spec/sidekiq/generate_financial_reports_for_previous_month_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe GenerateFinancialReportsForPreviousMonthJob do describe ".perform" do it "does not generate any reports when the Rails environment is not production" do described_class.new.perform expect(CreateCanadaMonthlySalesReportJob.jobs.size).to eq...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_us_states_sales_summary_report_job_spec.rb
spec/sidekiq/create_us_states_sales_summary_report_job_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateUsStatesSalesSummaryReportJob do let(:subdivision_codes) { ["WA", "WI"] } 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_codes, month, 2...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/charge_preorder_worker_spec.rb
spec/sidekiq/charge_preorder_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe ChargePreorderWorker, :vcr do describe "#perform" do before do @good_card = build(:chargeable) @good_card_but_cant_charge = build(:chargeable_success_charge_decline) product = create(:product, price_cents: 600, is_in_preorder_state: ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/calculate_payout_numbers_worker_spec.rb
spec/sidekiq/calculate_payout_numbers_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe CalculatePayoutNumbersWorker, :sidekiq_inline, :elasticsearch_wait_for_refresh do describe "#perform" do before { recreate_model_indices(Purchase) } context "when purchases are present" do let(:now) { Time.now.in_time_zone("America/Los_Ange...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/block_object_worker_spec.rb
spec/sidekiq/block_object_worker_spec.rb
# frozen_string_literal: true describe BlockObjectWorker do describe "#perform" do let(:admin_user) { create(:admin_user) } context "when blocking email domain" do let(:identifier) { "example.com" } it "blocks email domains without expiration" do expect(BlockedObject.email_domain.count)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/suspend_accounts_with_payment_address_worker_spec.rb
spec/sidekiq/suspend_accounts_with_payment_address_worker_spec.rb
# frozen_string_literal: true describe SuspendAccountsWithPaymentAddressWorker do describe "#perform" do before do @user = create(:user, payment_address: "sameuser@paypal.com") @user_2 = create(:user, payment_address: "sameuser@paypal.com") create(:user) # admin user end it "suspends o...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/log_resend_event_job_spec.rb
spec/sidekiq/log_resend_event_job_spec.rb
# frozen_string_literal: true describe LogResendEventJob do describe "#perform" do let(:email) { "example@example.com" } let(:email_digest) { Digest::SHA1.hexdigest(email).first(12) } let(:event_timestamp) { 5.minutes.from_now } before do Feature.activate(:log_email_events) EmailEvent.lo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/score_product_worker_spec.rb
spec/sidekiq/score_product_worker_spec.rb
# frozen_string_literal: true describe ScoreProductWorker, :vcr do describe "#perform" do before do allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production")) end it "sends message to SQS risk queue" do sqs_client = instance_double(Aws::SQS::Client) queue...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/handle_grmc_callback_job_spec.rb
spec/sidekiq/handle_grmc_callback_job_spec.rb
# frozen_string_literal: true describe HandleGrmcCallbackJob do let(:product_file) { create(:product_file) } let(:transcoded_video) { create(:transcoded_video, job_id: "test_job_id", streamable: product_file, transcoded_video_key: "/attachments/68756f28973n28347/hls/", state: :processing) } describe "#perform" ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/send_payment_reminder_worker_spec.rb
spec/sidekiq/send_payment_reminder_worker_spec.rb
# frozen_string_literal: true describe SendPaymentReminderWorker do describe "perform" do before do @user = create(:user, payment_address: nil) create(:balance, user: @user, amount_cents: 1001) end it "notifies users to update payment information" do expect do described_class.n...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/sidekiq/create_licenses_for_existing_customers_worker_spec.rb
spec/sidekiq/create_licenses_for_existing_customers_worker_spec.rb
# frozen_string_literal: true require "spec_helper" describe CreateLicensesForExistingCustomersWorker do describe "#perform" do before(:each) do @purchase1 = create(:purchase) @product = @purchase1.link @purchase2 = create(:purchase, link: @product) @purchase3 = create(:purchase, link: @...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false