source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/charge_refund_spec.rb | Ruby | mit | 8,966 | main | 402 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/charge_processor_spec.rb | Ruby | mit | 8,966 | main | 14,680 | # 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)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/base_processor_charge_spec.rb | Ruby | mit | 8,966 | main | 396 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/chargeable_spec.rb | Ruby | mit | 8,966 | main | 9,364 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/charge_shared_examples.rb | Ruby | mit | 8,966 | main | 794 | # 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 "... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/charge_refund_shared_examples.rb | Ruby | mit | 8,966 | main | 604 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/flow_of_funds_spec.rb | Ruby | mit | 8,966 | main | 1,256 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/chargeable_protocol.rb | Ruby | mit | 8,966 | main | 5,414 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_charge_processor_spec.rb | Ruby | mit | 8,966 | main | 21,187 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_chargeable_transient_customer_spec.rb | Ruby | mit | 8,966 | main | 4,646 | # 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(... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_charge_spec.rb | Ruby | mit | 8,966 | main | 2,189 | # 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 = {
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_charge_refund_spec.rb | Ruby | mit | 8,966 | main | 2,130 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_chargeable_nonce_spec.rb | Ruby | mit | 8,966 | main | 2,226 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/braintree/braintree_charge_intent_spec.rb | Ruby | mit | 8,966 | main | 658 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_chargeable_payment_method_spec.rb | Ruby | mit | 8,966 | main | 6,383 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_charge_refund_spec.rb | Ruby | mit | 8,966 | main | 9,761 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_chargeable_common_shared_examples.rb | Ruby | mit | 8,966 | main | 248 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_setup_intent_spec.rb | Ruby | mit | 8,966 | main | 2,908 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_charge_processor_spec.rb | Ruby | mit | 8,966 | main | 178,560 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_chargeable_token_spec.rb | Ruby | mit | 8,966 | main | 1,921 | # 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 }... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_charge_radar_processor_spec.rb | Ruby | mit | 8,966 | main | 11,166 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_chargeable_credit_card_spec.rb | Ruby | mit | 8,966 | main | 11,793 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_charge_spec.rb | Ruby | mit | 8,966 | main | 11,240 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/stripe/stripe_charge_intent_spec.rb | Ruby | mit | 8,966 | main | 5,063 | # 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,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_card_fingerprint_spec.rb | Ruby | mit | 8,966 | main | 1,040 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_charge_intent_spec.rb | Ruby | mit | 8,966 | main | 634 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_order_refund_spec.rb | Ruby | mit | 8,966 | main | 563 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_chargeable_spec.rb | Ruby | mit | 8,966 | main | 1,332 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_rest_api_spec.rb | Ruby | mit | 8,966 | main | 20,393 | # 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 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_charge_spec.rb | Ruby | mit | 8,966 | main | 23,623 | # 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" => [
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_charge_processor_spec.rb | Ruby | mit | 8,966 | main | 109,468 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_approved_order_chargeable_spec.rb | Ruby | mit | 8,966 | main | 1,494 | # 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,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/charging/implementations/paypal/paypal_charge_refund_spec.rb | Ruby | mit | 8,966 | main | 1,046 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/transfers/stripe/stripe_transfer_externally_to_gumroad_spec.rb | Ruby | mit | 8,966 | main | 5,078 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/transfers/stripe/stripe_transfer_internally_to_creator_spec.rb | Ruby | mit | 8,966 | main | 5,562 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/merchant_registration/paypal/paypal_merchant_account_manager_spec.rb | Ruby | mit | 8,966 | main | 15,527 | # 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.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/events/paypal/paypal_event_handler_spec.rb | Ruby | mit | 8,966 | main | 15,214 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/events/paypal/paypal_webhook_verifier_spec.rb | Ruby | mit | 8,966 | main | 4,602 | # frozen_string_literal: true
require "spec_helper"
describe PaypalWebhookVerifier do
let(:headers) do
{
"HTTP_PAYPAL_TRANSMISSION_ID" => "abc",
"HTTP_PAYPAL_TRANSMISSION_SIG" => "sig",
"HTTP_PAYPAL_CERT_URL" => "https://api.paypal.com/certs/123",
"HTTP_PAYPAL_AUTH_ALGO" => "SHA256",
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/payments/events/stripe/stripe_event_handler_spec.rb | Ruby | mit | 8,966 | main | 11,173 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/card_data_handling/card_data_handling_error_spec.rb | Ruby | mit | 8,966 | main | 960 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/business/card_data_handling/card_data_handling_mode_spec.rb | Ruby | mit | 8,966 | main | 1,418 | # 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")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/mauritius_bank_accounts.rb | Ruby | mit | 8,966 | main | 280 | # frozen_string_literal: true
FactoryBot.define do
factory :mauritius_bank_account do
user
account_number { "MU17BOMM0101101030300200000MUR" }
account_number_last_four { "0MUR" }
bank_code { "AAAAMUMUXYZ" }
account_holder_full_name { "John Doe" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/cambodia_bank_accounts.rb | Ruby | mit | 8,966 | main | 270 | # frozen_string_literal: true
FactoryBot.define do
factory :cambodia_bank_account do
user
bank_code { "AAAAKHKHXXX" }
account_number { "000123456789" }
account_number_last_four { "6789" }
account_holder_full_name { "Cambodian Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/community_notification_settings.rb | Ruby | mit | 8,966 | main | 334 | # frozen_string_literal: true
FactoryBot.define do
factory :community_notification_setting do
association :user
association :seller, factory: :user
recap_frequency { "daily" }
trait :weekly_recap do
recap_frequency { "weekly" }
end
trait :no_recap do
recap_frequency { nil }
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/utm_link_visits.rb | Ruby | mit | 8,966 | main | 302 | # frozen_string_literal: true
FactoryBot.define do
factory :utm_link_visit do
association :utm_link
user { nil }
ip_address { "127.0.0.1" }
browser_guid { SecureRandom.uuid }
country_code { "US" }
referrer { "https://twitter.com" }
user_agent { "Mozilla/5.0" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/totp_credentials.rb | Ruby | mit | 8,966 | main | 332 | # frozen_string_literal: true
FactoryBot.define do
factory :totp_credential do
association :user
trait :confirmed do
confirmed_at { Time.current }
end
trait :with_recovery_codes do
confirmed
after(:create) do |credential|
credential.generate_recovery_codes
end
en... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/benin_bank_accounts.rb | Ruby | mit | 8,966 | main | 247 | # frozen_string_literal: true
FactoryBot.define do
factory :benin_bank_account do
user
account_number { "BJ66BJ0610100100144390000769" }
account_number_last_four { "0769" }
account_holder_full_name { "Benin Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/el_salvador_bank_accounts.rb | Ruby | mit | 8,966 | main | 288 | # frozen_string_literal: true
FactoryBot.define do
factory :el_salvador_bank_account do
association :user
bank_number { "AAAASVS1XXX" }
account_number { "12345678901234" }
account_number_last_four { "1234" }
account_holder_full_name { "Chuck Bartowski" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/billing_details.rb | Ruby | mit | 8,966 | main | 688 | # frozen_string_literal: true
FactoryBot.define do
factory :billing_detail do
association :purchaser, factory: :user
full_name { "John Doe" }
business_name { "Acme Corporation" }
business_id { "DE123456789" }
street_address { "123 Main Street" }
city { "Berlin" }
zip_code { "10115" }
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/scheduled_payouts.rb | Ruby | mit | 8,966 | main | 246 | # frozen_string_literal: true
FactoryBot.define do
factory :scheduled_payout do
user
action { "payout" }
delay_days { 21 }
scheduled_at { 21.days.from_now }
status { "pending" }
payout_amount_cents { 10_000 }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/product_installment_plans.rb | Ruby | mit | 8,966 | main | 252 | # frozen_string_literal: true
FactoryBot.define do
factory :product_installment_plan do
link { create(:product, price_cents: 1000, native_type: Link::NATIVE_TYPE_DIGITAL) }
number_of_installments { 3 }
recurrence { "monthly" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/community_chat_recap_runs.rb | Ruby | mit | 8,966 | main | 596 | # frozen_string_literal: true
FactoryBot.define do
factory :community_chat_recap_run do
recap_frequency { "daily" }
from_date { (Time.current - rand(1..1000).days).beginning_of_day }
to_date { (Time.current - rand(1..1000).days).end_of_day }
recaps_count { 0 }
trait :weekly do
recap_freque... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/community_chat_recaps.rb | Ruby | mit | 8,966 | main | 510 | # frozen_string_literal: true
FactoryBot.define do
factory :community_chat_recap do
association :community_chat_recap_run
association :community
association :seller, factory: :user
summarized_message_count { 10 }
input_token_count { 1000 }
output_token_count { 200 }
status { "pending" }
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/moldova_bank_accounts.rb | Ruby | mit | 8,966 | main | 292 | # frozen_string_literal: true
FactoryBot.define do
factory :moldova_bank_account do
association :user
bank_code { "AAAAMDMDXXX" }
account_number { "MD07AG123456789012345678" }
account_number_last_four { "5678" }
account_holder_full_name { "Chuck Bartowski" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/kuwait_bank_accounts.rb | Ruby | mit | 8,966 | main | 284 | # frozen_string_literal: true
FactoryBot.define do
factory :kuwait_bank_account do
user
bank_code { "AAAAKWKWXYZ" }
account_number { "KW81CBKU0000000000001234560101" }
account_number_last_four { "0101" }
account_holder_full_name { "Kuwaiti Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/macao_bank_accounts.rb | Ruby | mit | 8,966 | main | 270 | # frozen_string_literal: true
FactoryBot.define do
factory :macao_bank_account do
user
account_number { "0000000001234567897" }
account_number_last_four { "7897" }
bank_code { "AAAAMOMXXXX" }
account_holder_full_name { "Macao Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/utm_links.rb | Ruby | mit | 8,966 | main | 325 | # frozen_string_literal: true
FactoryBot.define do
factory :utm_link do
association :seller, factory: :user
sequence(:title) { |n| "UTM Link #{n}" }
target_resource_type { :profile_page }
sequence(:utm_campaign) { |n| "summer-sale-#{n}" }
utm_medium { "social" }
utm_source { "twitter" }
end... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/mongolia_bank_accounts.rb | Ruby | mit | 8,966 | main | 268 | # frozen_string_literal: true
FactoryBot.define do
factory :mongolia_bank_account do
user
bank_code { "AAAAMNUBXXX" }
account_number { "0002222001" }
account_number_last_four { "2001" }
account_holder_full_name { "Mongolian Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/public_files.rb | Ruby | mit | 8,966 | main | 555 | # frozen_string_literal: true
FactoryBot.define do
factory :public_file do
sequence(:original_file_name) { |n| "test-#{n}.mp3" }
sequence(:display_name) { |n| "Test audio #{n}" }
public_id { PublicFile.generate_public_id }
resource { association :product }
trait :with_audio do
after(:build... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/bolivia_bank_accounts.rb | Ruby | mit | 8,966 | main | 286 | # frozen_string_literal: true
FactoryBot.define do
factory :bolivia_bank_account do
user
account_number { "000123456789" }
bank_code { "040" }
account_number_last_four { "6789" }
account_holder_full_name { "Chuck Bartowski" }
state { "unverified" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/uzbekistan_bank_accounts.rb | Ruby | mit | 8,966 | main | 306 | # frozen_string_literal: true
FactoryBot.define do
factory :uzbekistan_bank_account do
user
account_number { "99934500012345670024" }
bank_code { "AAAAUZUZXXX" }
branch_code { "00000" }
account_number_last_four { "0024" }
account_holder_full_name { "Chuck Bartowski" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/armenia_bank_accounts.rb | Ruby | mit | 8,966 | main | 266 | # frozen_string_literal: true
FactoryBot.define do
factory :armenia_bank_account do
user
bank_code { "AAAAAMNNXXX" }
account_number { "00001234567" }
account_number_last_four { "4567" }
account_holder_full_name { "Armenia creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/dominican_republic_bank_accounts.rb | Ruby | mit | 8,966 | main | 270 | # frozen_string_literal: true
FactoryBot.define do
factory :dominican_republic_bank_account do
user
account_number { "000123456789" }
bank_code { "999" }
account_number_last_four { "6789" }
account_holder_full_name { "Chuck Bartowski" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/cote_d_ivoire_bank_accounts.rb | Ruby | mit | 8,966 | main | 263 | # frozen_string_literal: true
FactoryBot.define do
factory :cote_d_ivoire_bank_account do
user
account_number { "CI93CI0080111301134291200589" }
account_number_last_four { "0589" }
account_holder_full_name { "Cote d'Ivoire Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/sri_lanka_bank_accounts.rb | Ruby | mit | 8,966 | main | 300 | # frozen_string_literal: true
FactoryBot.define do
factory :sri_lanka_bank_account do
user
bank_code { "AAAALKLXXXX" }
branch_code { "7010999" }
account_number { "0000012345" }
account_number_last_four { "2345" }
account_holder_full_name { "Sri Lankan Creator" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/panama_bank_accounts.rb | Ruby | mit | 8,966 | main | 281 | # frozen_string_literal: true
FactoryBot.define do
factory :panama_bank_account do
association :user
bank_number { "AAAAPAPAXXX" }
account_number { "000123456789" }
account_number_last_four { "6789" }
account_holder_full_name { "Chuck Bartowski" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/uruguay_bank_accounts.rb | Ruby | mit | 8,966 | main | 252 | # frozen_string_literal: true
FactoryBot.define do
factory :uruguay_bank_account do
user
account_number { "000123456789" }
account_number_last_four { "6789" }
bank_code { "999" }
account_holder_full_name { "John Doe" }
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/factories/jamaica_bank_accounts.rb | Ruby | mit | 8,966 | main | 353 | # frozen_string_literal: true
FactoryBot.define do
factory :jamaica_bank_account do
user
bank_code { "111" } # 3-digit bank code
branch_code { "00000" } # 5-digit branch code
account_number { "000123456789" } # 1-18 digit account number
account_number_last_four { "6789" }
account_holder_fu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/custom_domain_verification_service_spec.rb | Ruby | mit | 8,966 | main | 5,641 | # frozen_string_literal: true
require "spec_helper"
describe CustomDomainVerificationService do
let(:domain) { "example.com" }
subject(:service) { described_class.new(domain:) }
describe "#process" do
describe "domain CNAME configuration" do
let(:domain) { "store.example.com" }
context "when t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/adult_keyword_detector_spec.rb | Ruby | mit | 8,966 | main | 624 | # frozen_string_literal: true
require "spec_helper"
describe AdultKeywordDetector do
it "classifies adult text as such" do
["nude2screen",
"PussyStuff",
"abs punch product",
"futa123",
"uncensored",
"Click here for #HotHentaiComics!"].each do |text|
expect(described_class.adult?(t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/abn_validation_service_spec.rb | Ruby | mit | 8,966 | main | 3,096 | # frozen_string_literal: true
require "spec_helper"
describe AbnValidationService do
before do
@vatstack_response = {
"active" => true,
"company_address" => "NSW 2020",
"company_name" => "KANGAROO AIRWAYS LIMITED",
"company_type" => "PUB",
"consultation_number" => nil,
"count... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/tra_tin_validation_service_spec.rb | Ruby | mit | 8,966 | main | 1,022 | # frozen_string_literal: true
require "spec_helper"
describe TraTinValidationService do
it "returns true when valid Tanzania TIN is provided" do
tin = "12-345678-A"
expect(described_class.new(tin).process).to be(true)
end
it "returns false when nil TIN is provided" do
expect(described_class.new(nil... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/purchase_search_service_spec.rb | Ruby | mit | 8,966 | main | 29,041 | # frozen_string_literal: true
require "spec_helper"
describe PurchaseSearchService do
describe "#process" do
it "can filter by seller" do
purchase_1 = create(:purchase)
purchase_2 = create(:purchase, link: purchase_1.link) # same seller as purchase_1
seller_1 = purchase_1.seller
purchase... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/update_payout_method_spec.rb | Ruby | mit | 8,966 | main | 8,079 | # frozen_string_literal: true
require "spec_helper"
describe UpdatePayoutMethod do
describe "#process" do
describe "updating only the account holder name" do
let(:user) { create(:named_user) }
context "when the seller is in a country that syncs holder name to Stripe" do
let!(:bank_account) ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/robots_service_spec.rb | Ruby | mit | 8,966 | main | 1,672 | # frozen_string_literal: true
require "spec_helper"
describe RobotsService do
before do
@redis_namespace = Redis::Namespace.new(:robots_redis_namespace, redis: $redis)
@sitemap_config = "Sitemap: https://test-public-files.gumroad.com/products/sitemap.xml"
@user_agent_rules = ["User-agent: *", "Disallow:... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/seller_mobile_analytics_service_spec.rb | Ruby | mit | 8,966 | main | 9,547 | # frozen_string_literal: true
require "spec_helper"
describe SellerMobileAnalyticsService do
before do
@user = create(:user, timezone: "UTC")
@product = create(:product, user: @user)
end
describe "#process" do
it "returns the proper purchase data for all time" do
valid_purchases = []
tr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/community_chat_recap_generator_service_spec.rb | Ruby | mit | 8,966 | main | 6,937 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe CommunityChatRecapGeneratorService do
let(:seller) { create(:user) }
let(:community) { create(:community, seller:) }
describe "#process" do
context "when recap is already finished" do
let(:community_chat_recap) { create(:community_cha... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/helper_user_info_service_spec.rb | Ruby | mit | 8,966 | main | 10,580 | # frozen_string_literal: true
require "spec_helper"
describe HelperUserInfoService do
include Rails.application.routes.url_helpers
let(:user) { create(:user, email: "user@example.com") }
describe "#customer_info" do
let(:service) { described_class.new(email: user.email) }
it "retrieves user info" do
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/product_indexing_service_spec.rb | Ruby | mit | 8,966 | main | 1,922 | # frozen_string_literal: true
require "spec_helper"
describe ProductIndexingService do
before do
@product = create(:product)
end
describe "#perform" do
it "can index documents" do
# Empty the index for the purpose of this test
recreate_model_indices(Link)
described_class.perform(prod... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/instant_payouts_service_spec.rb | Ruby | mit | 8,966 | main | 8,177 | # frozen_string_literal: true
require "spec_helper"
describe InstantPayoutsService, :vcr do
let(:seller) { create(:compliant_user) }
before do
create(:tos_agreement, user: seller)
create(:user_compliance_info, user: seller)
create_list(:payment_completed, 4, user: seller)
end
describe "#perform"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/rpush_fcm_app_service_spec.rb | Ruby | mit | 8,966 | main | 1,604 | # frozen_string_literal: true
require "spec_helper"
describe RpushFcmAppService do
let!(:app_name) { Device::APP_TYPES[:consumer] }
describe "#first_or_create!" do
before do
Rpush::Fcm::App.all.each(&:destroy)
Modis.with_connection do |redis|
redis.flushdb
end
end
context "... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/vat_validation_service_spec.rb | Ruby | mit | 8,966 | main | 1,313 | # frozen_string_literal: true
require "spec_helper"
describe VatValidationService, :vcr do
describe "#process" do
it "returns false when provided vat is nil" do
expect(described_class.new(nil).process).to be(false)
end
it "returns false when invalid vat is provided" do
expect(described_clas... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/best_offer_code_service_spec.rb | Ruby | mit | 8,966 | main | 15,213 | # frozen_string_literal: true
require "spec_helper"
describe BestOfferCodeService do
let(:seller) { create(:user) }
let(:product) { create(:product, user: seller, price_cents: 1000, price_currency_type: "usd") }
let(:url_code) { nil }
let(:quantity) { 1 }
subject { described_class.new(product: product, url... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/email_redactor_service_spec.rb | Ruby | mit | 8,966 | main | 625 | # frozen_string_literal: true
require "spec_helper"
describe EmailRedactorService do
it "redacts short emails" do
expect(EmailRedactorService.redact("foo@bar.baz")).to eq("f*o@b**.baz")
end
it "redacts 1 char emails" do
expect(EmailRedactorService.redact("a@b.co")).to eq("a@b.co")
end
it "redacts ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/oman_vat_number_validation_service_spec.rb | Ruby | mit | 8,966 | main | 924 | # frozen_string_literal: true
require "spec_helper"
describe OmanVatNumberValidationService do
it "returns true when valid VAT number is provided" do
vat_number = "OM1234567890"
expect(described_class.new(vat_number).process).to be(true)
end
it "returns false when nil VAT number is provided" do
exp... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/installment_search_service_spec.rb | Ruby | mit | 8,966 | main | 4,364 | # frozen_string_literal: true
require "spec_helper"
describe InstallmentSearchService do
describe "#process" do
it "can filter by seller" do
product_1 = create(:product)
installment_1 = create(:installment, link: product_1)
installment_2 = create(:installment, link: product_1)
creator_1 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/notion_api_spec.rb | Ruby | mit | 8,966 | main | 833 | # frozen_string_literal: true
require "spec_helper"
describe NotionApi, :vcr do
let(:user) { create(:user, email: "user@example.com") }
describe "#get_bot_token" do
before do
allow(GlobalConfig).to receive(:get).and_return(nil)
allow(GlobalConfig).to receive(:get).with("NOTION_OAUTH_CLIENT_ID").a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/recommended_wishlists_service_spec.rb | Ruby | mit | 8,966 | main | 2,589 | # frozen_string_literal: true
require "spec_helper"
describe RecommendedWishlistsService do
describe ".fetch" do
let!(:wishlists) do
5.times.map { |i| create(:wishlist, name: "Recommendable #{i}", recent_follower_count: i, recommendable: true) }
end
let(:recommended_products) { create_list(:produ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/tip_options_services_spec.rb | Ruby | mit | 8,966 | main | 3,088 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe TipOptionsService, type: :service do
describe ".get_tip_options" do
context "when Redis has valid tip options" do
before do
$redis.set(RedisKey.tip_options, "[10, 20, 30]")
end
it "returns the parsed tip options" do
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/gdpr_data_erasure_service_spec.rb | Ruby | mit | 8,966 | main | 6,348 | # frozen_string_literal: true
require "spec_helper"
describe GdprDataErasureService do
let(:user) { create(:user, email: "john@example.com", name: "John Doe", bio: "My bio", street_address: "123 Main St", city: "New York", state: "NY", zip_code: "10001", country: "US") }
let(:admin) { create(:user, email: "admin@... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/secure_encrypt_service_spec.rb | Ruby | mit | 8,966 | main | 2,735 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe SecureEncryptService do
let(:key) { SecureRandom.random_bytes(32) }
let(:text) { "this is a secret message" }
before do
allow(GlobalConfig).to receive(:get).with("SECURE_ENCRYPT_KEY").and_return(key)
# Reset memoized encryptor
descr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/redis_key_spec.rb | Ruby | mit | 8,966 | main | 731 | # frozen_string_literal: true
require "spec_helper"
describe RedisKey do
describe ".ai_request_throttle" do
it "returns a properly formatted redis key with user id" do
user_id = 123
key = described_class.ai_request_throttle(user_id)
expect(key).to eq("ai_request_throttle:123")
end
it... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/default_abandoned_cart_workflow_generator_service_spec.rb | Ruby | mit | 8,966 | main | 1,913 | # frozen_string_literal: true
require "spec_helper"
describe DefaultAbandonedCartWorkflowGeneratorService do
include Rails.application.routes.url_helpers
let(:seller) { create(:user) }
subject { described_class.new(seller:) }
describe "#generate" do
context "when seller does not have an abandoned cart ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/gst_validation_service_spec.rb | Ruby | mit | 8,966 | main | 3,186 | # frozen_string_literal: true
require "spec_helper"
describe GstValidationService do
it "returns true when valid a gst id is provided" do
gst_id = "T9100001B"
success_response = {
"returnCode" => "10",
"data" => {
"gstRegistrationNumber" => "T9100001B",
"name" => "GUMROAD, INC."... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/home_page_link_service_spec.rb | Ruby | mit | 8,966 | main | 659 | # frozen_string_literal: true
require "spec_helper"
describe HomePageLinkService do
shared_examples_for "home page link" do |page|
describe ".#{page}" do
it "returns the full URL of the page" do
expect(described_class.public_send(page)).to eq "#{UrlService.root_domain_with_protocol}/#{page}"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/save_utm_link_service_spec.rb | Ruby | mit | 8,966 | main | 6,457 | # frozen_string_literal: true
require "spec_helper"
describe SaveUtmLinkService do
let(:seller) { create(:user) }
let(:product) { create(:product, user: seller) }
let(:post) { create(:audience_post, :published, shown_on_profile: true, seller:) }
describe "#perform" do
context "when 'utm_link' is not prov... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/gmail_abuse_filter_spec.rb | Ruby | mit | 8,966 | main | 2,890 | # frozen_string_literal: true
require "spec_helper"
describe GmailAbuseFilter do
after { $redis.del(described_class::REDIS_KEY) }
describe ".exists?" do
before { described_class.add!("abuser@gmail.com") }
it "returns true for a matching normalized email" do
expect(described_class.exists?("abuser@g... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/subscribe_preview_generator_service_spec.rb | Ruby | mit | 8,966 | main | 1,137 | # frozen_string_literal: true
require "spec_helper"
describe SubscribePreviewGeneratorService, type: :system, js: true do
describe "#generate_pngs" do
before do
@user1 = create(:user, name: "User 1", username: "user1")
@user2 = create(:user, name: "User 2", username: "user2")
visit user_subscr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/save_content_upsells_service_spec.rb | Ruby | mit | 8,966 | main | 4,965 | # frozen_string_literal: true
describe SaveContentUpsellsService do
let(:seller) { create(:user) }
let(:product) { create(:product, user: seller, price_cents: 1000) }
let(:variant_category) { create(:variant_category, link: product) }
let(:variant) { create(:variant, variant_category:) }
describe "#from_htm... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/services/update_user_country_spec.rb | Ruby | mit | 8,966 | main | 3,732 | # frozen_string_literal: true
require "spec_helper"
describe UpdateUserCountry do
before do
@user = create(:named_user)
create(:ach_account_stripe_succeed, user: @user)
create(:ach_account, user: @user)
create(:user_compliance_info, user: @user)
create(:merchant_account, user: @user, charge_proc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.