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/models/installment/installment_tracking_spec.rb
spec/models/installment/installment_tracking_spec.rb
# frozen_string_literal: true require "spec_helper" describe "InstallmentTracking" do before do @creator = create(:named_user, :with_avatar) @installment = create(:installment, call_to_action_text: "CTA", call_to_action_url: "https://www.example.com", seller: @creator) end describe "click_summary" do ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/admin/sales_report_spec.rb
spec/models/admin/sales_report_spec.rb
# frozen_string_literal: true require "spec_helper" describe Admin::SalesReport do let(:valid_attributes) do { country_code: "US", start_date: "2023-01-01", end_date: "2023-12-31", sales_type: GenerateSalesReportJob::ALL_SALES, } end describe "validations" do context "countr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/help_center/category_spec.rb
spec/models/help_center/category_spec.rb
# frozen_string_literal: true require "spec_helper" describe HelpCenter::Category do describe "#categories_for_same_audience" do it "returns the categories with the same audience" do expect(HelpCenter::Category::ACCESSING_YOUR_PURCHASE.categories_for_same_audience).to contain_exactly( HelpCenter::...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/mailer_info/encryption_spec.rb
spec/models/mailer_info/encryption_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe MailerInfo::Encryption do describe ".encrypt" do it "returns nil for nil input" do expect(described_class.encrypt(nil)).to be_nil end it "encrypts value with current key version" do encrypted = described_class.encrypt("test"...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/mailer_info/router_spec.rb
spec/models/mailer_info/router_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe MailerInfo::Router do let(:domain) { :gumroad } let(:date) { Date.current } describe ".determine_email_provider" do it "raises error for invalid domain" do expect do described_class.determine_email_provider(:invalid) end...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/mailer_info/header_builder_spec.rb
spec/models/mailer_info/header_builder_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe MailerInfo::HeaderBuilder do let(:mailer_class) { "CustomerMailer" } let(:mailer_method) { "test_email" } let(:mailer_args) { ["test@example.com"] } describe ".perform" do it "delegates to instance" do instance = instance_double(des...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/mailer_info/delivery_method_spec.rb
spec/models/mailer_info/delivery_method_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe MailerInfo::DeliveryMethod do describe ".options" do let(:email_provider) { MailerInfo::EMAIL_PROVIDER_SENDGRID } context "with invalid domain" do it "raises ArgumentError" do expect { described_class.options(domain: :invalid,...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_gifts_spec.rb
spec/models/purchase/purchase_gifts_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseGifts", :vcr do include CurrencyHelper include ProductsHelper describe "gifts" do before do gifter_email = "gifter@foo.com" giftee_email = "giftee@foo.com" @product = create(:product) gift = create(:gift, gifter_e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_zip_spec.rb
spec/models/purchase/purchase_zip_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Purchase Zip Scenarios", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end let(:ip_address) { "24.7.90.214" } let(:initial_balance...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_installments_spec.rb
spec/models/purchase/purchase_installments_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseInstallments", :vcr do include CurrencyHelper include ProductsHelper describe ".product_installments" do it "can return installments for several purchases" do product = create(:product) variant = create(:variant, variant_cate...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_sales_tax_spec.rb
spec/models/purchase/purchase_sales_tax_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseSalesTax", :vcr do include CurrencyHelper include ProductsHelper describe "sales tax" do let(:chargeable) { build(:chargeable) } let(:price) { 10_00 } let(:buyer_zip) { nil } # forces using ip by default let(:link_is_physica...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_balances_spec.rb
spec/models/purchase/purchase_balances_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseBalances", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end describe "proper Balance creation and association with purchas...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_taxation_spec.rb
spec/models/purchase/purchase_taxation_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseTaxation", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end describe "sales tax with merchant_migration enabled" do let...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_refunds_spec.rb
spec/models/purchase/purchase_refunds_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseRefunds", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end describe "refund purchase" do let(:merchant_account) { nil }...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_process_spec.rb
spec/models/purchase/purchase_process_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Purchase Process", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end shared_examples_for "skipping chargeable steps" do |for_test_pu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_notification_spec.rb
spec/models/purchase/purchase_notification_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Purchase Notifications", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end let(:ip_address) { "24.7.90.214" } let(:initial_balance...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/purchase/purchase_subscription_spec.rb
spec/models/purchase/purchase_subscription_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PurchaseSubscription", :vcr do include CurrencyHelper include ProductsHelper def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end describe "subscriptions" do describe "original subscrip...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/models/payment_option/installment_plan_snapshot_spec.rb
spec/models/payment_option/installment_plan_snapshot_spec.rb
# frozen_string_literal: true require "spec_helper" describe "PaymentOption installment plan snapshots" do let(:seller) { create(:user) } let(:product) { create(:product, user: seller, price_cents: 14700) } let(:installment_plan) { create(:product_installment_plan, link: product, number_of_installments: 3, recu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/file_group_download_all.rb
spec/shared_examples/file_group_download_all.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "a product with 'Download all' buttons on file embed groups" do before do file1 = create(:product_file, display_name: "File 1") file2 = create(:product_file, display_name: "File 2") @file3 = create(:product_file, display_name:...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/discover_layout.rb
spec/shared_examples/discover_layout.rb
# frozen_string_literal: true require "spec_helper" shared_examples_for "discover navigation when layout is discover" do |selected_taxonomy: nil| it "shows the discover layout when the param is passed" do visit discover_url expect(page).to have_link("Log in") expect(page).to have_link("Start selling") ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/admin_commentable_concern.rb
spec/shared_examples/admin_commentable_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "Admin::Commentable" do let(:admin_user) { create(:admin_user) } let(:commentable_object) { raise NotImplementedError, "Define commentable_object in the spec" } let(:route_params) { raise NotImplementedError, "Define route_params in t...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/with_workflow_form_context.rb
spec/shared_examples/with_workflow_form_context.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "with workflow form 'context' in response" do let!(:product1) { create(:product_with_digital_versions, name: "Product 1", user:) } let!(:product2) { create(:product, name: "Product 2", user:, archived: true) } let!(:membership) { crea...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/max_purchase_count_concern.rb
spec/shared_examples/max_purchase_count_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "MaxPurchaseCount concern" do |factory_name| it "automatically constrains the max_purchase_count" do object = create(factory_name) object.update!(max_purchase_count: 999_999_999_999) expect(object.max_purchase_count).to eq(10_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/products_navigation.rb
spec/shared_examples/products_navigation.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "tab navigation on products page" do it "shows the correct tabs" do create(:product, user: seller) visit url within find("[role=tablist]") do expect(find(:tab_button, "All products")[:href]).to eq(products_url(host: DO...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/receipt_presenter_concern.rb
spec/shared_examples/receipt_presenter_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_context "when is a preorder authorization" do let(:preorder_link) { create(:preorder_link, link: purchase.link, release_at: DateTime.parse("Dec 1 2223 10AM PST")) } before do preorder = create(:preorder, preorder_link:, seller: product.user, st...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/authorize_called.rb
spec/shared_examples/authorize_called.rb
# frozen_string_literal: true require "spec_helper" # Checks that `authorize` is called with correct policy for each controller action # Pulls all controller actions programmatically from Routes. # RSpec.shared_examples_for "authorize called for controller" do |policy_klass| controller_path = described_class.to_s.u...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/admin_base_controller_concern.rb
spec/shared_examples/admin_base_controller_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "inherits from Admin::BaseController" do it { expect(controller.class.ancestors.include?(Admin::BaseController)).to eq(true) } end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/sellers_base_controller_concern.rb
spec/shared_examples/sellers_base_controller_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "inherits from Sellers::BaseController" do it { expect(controller.class.ancestors.include?(Sellers::BaseController)).to eq(true) } end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/versionable_concern.rb
spec/shared_examples/versionable_concern.rb
# frozen_string_literal: true require "spec_helper" # options contains a hash with versionable fields for factory as keys, and each # field's value is an array of 2 values: before and after. After value is optional. # Sample spec integration: # # it_behaves_like "Versionable concern", :user, { # email: %w(user@exam...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/with_sorting_and_pagination.rb
spec/shared_examples/with_sorting_and_pagination.rb
# frozen_string_literal: true require "spec_helper" def product_names(response) response.parsed_body["entries"].map { _1["name"] } end RSpec.shared_examples_for "an API for sorting and pagination" do |action| it "correctly sorts and paginates the records" do if default_order.present? order = default_or...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/collaborator_access.rb
spec/shared_examples/collaborator_access.rb
# frozen_string_literal: true require "spec_helper" # Checks that a collaborator on a product can access the endpoint # Accepted shared variables: # * product (required) # * request_params (optional) # * request_format (optional) # * response_status (optional) # * response_attributes (optional) RSpec.shared_examples...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/authorized_helper_api_method.rb
spec/shared_examples/authorized_helper_api_method.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "helper api authorization required" do |verb, action| before do request.headers["Authorization"] = "Bearer #{GlobalConfig.get("HELPER_TOOLS_TOKEN")}" end context "when the token is invalid" do it "returns 401 error" do ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/order_association_with_cart_post_checkout.rb
spec/shared_examples/order_association_with_cart_post_checkout.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "order association with cart post checkout" do let!(:user_cart) { create(:cart, user:, browser_guid:) } let!(:guest_cart) { create(:cart, :guest, browser_guid:) } context "when the user is signed in" do before do sign_in_us...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/deletable_concern.rb
spec/shared_examples/deletable_concern.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "Deletable concern" do |factory_name| it "marks object as deleted" do object = create(factory_name) expect do object.mark_deleted! end.to change { object.deleted? }.from(false).to(true) end it "marks object as aliv...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/affiliate_cookie_concern.rb
spec/shared_examples/affiliate_cookie_concern.rb
# frozen_string_literal: true require "spec_helper" require "ipaddr" RSpec.shared_examples_for "AffiliateCookie concern" do before do @frozen_time = Time.current travel_to(@frozen_time) end it "sets affiliate cookie" do make_request expected_cookie_options = { expires: direct_affiliate.cl...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/authentication_required.rb
spec/shared_examples/authentication_required.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "authentication required for action" do |verb, action| before do sign_out :user end it "redirects to the login page" do public_send(verb, action, params: defined?(request_params) ? request_params : {}) expect(response).t...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/policy_examples.rb
spec/shared_examples/policy_examples.rb
# frozen_string_literal: true RSpec.shared_examples_for "an access-granting policy" do it "grants access" do seller_context = SellerContext.new(user: context_user, seller: context_seller) expect(subject).to permit(seller_context, record) end end RSpec.shared_examples_for "an access-granting policy for rol...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/authorized_oauth_v1_api_method.rb
spec/shared_examples/authorized_oauth_v1_api_method.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "authorized oauth v1 api method" do it "errors out if you aren't authenticated" do raise "no @action in before block of test" unless @action raise "no @params in before block of test" unless @params get @action, params: @para...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/paginated_api.rb
spec/shared_examples/paginated_api.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "a paginated API" do it "contains pagination meta in the response body" do get @action, params: @params expect(response.status).to eq(200) expect(response.parsed_body[@response_key_name].size).to eq(@records.size) expect(r...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/with_filtering_support.rb
spec/shared_examples/with_filtering_support.rb
# frozen_string_literal: true require "spec_helper" shared_examples_for "common customer recipient filter validation behavior" do |audience_type:| context "when #{audience_type} #{described_class.to_s.downcase}" do context "when no param filters are set" do let(:params) do { bought_produ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/creator_dashboard_page.rb
spec/shared_examples/creator_dashboard_page.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "creator dashboard page" do |title| it "marks the correct navigation link as active" do visit path within "nav", aria: { label: "Main" } do expect(page).to have_link(title, aria: { current: "page" }) end visit "#{pa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/shared_examples/merge_guest_cart_with_user_cart.rb
spec/shared_examples/merge_guest_cart_with_user_cart.rb
# frozen_string_literal: true require "spec_helper" RSpec.shared_examples_for "merge guest cart with user cart" do let(:browser_guid) { "123" } let(:guest_cart) { create(:cart, :guest, browser_guid:) } let(:user_cart) { create(:cart, user:, browser_guid:) } let(:product1) { create(:product) } let(:product2)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/mongoer_spec.rb
spec/modules/mongoer_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Mongoer" do it "does not throw exception if invalid character used" do Mongoer.safe_write("Link", "email" => "f@flick.com", "email for google.com" => "sid@sid.com") result = MONGO_DATABASE["Link"].find("email" => "f@flick.com").limit(1).first ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/external_id_spec.rb
spec/modules/external_id_spec.rb
# frozen_string_literal: true require "spec_helper" describe "ExternalId" do before do @purchase = create(:purchase) end describe "#find_by_external_id!" do it "finds the correct object if it exists" do encrypted_id = ObfuscateIds.encrypt(@purchase.id) expect(Purchase.find_by_external_id!(e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/timestamp_scopes_spec.rb
spec/modules/timestamp_scopes_spec.rb
# frozen_string_literal: true require "spec_helper" describe TimestampScopes do before do @purchase = create(:purchase, created_at: Time.utc(2020, 3, 9, 6, 30)) # Sun, 08 Mar 2020 23:30:00 PDT -07:00 end describe ".created_between" do it "returns records matching range" do expect(Purchase.created...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/with_product_files_spec.rb
spec/modules/with_product_files_spec.rb
# frozen_string_literal: true require "spec_helper" describe WithProductFiles do describe "associations" do context "has many `product_folders`" do it "does not return deleted folders" do product = create(:product) folder_1 = create(:product_folder, link: product) create(:product_f...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/sendable_to_kindle_spec.rb
spec/modules/sendable_to_kindle_spec.rb
# frozen_string_literal: true describe SendableToKindle do describe "#send_to_kindle" do before do @product_file = create(:product_file) end it "raises an error if the kindle email is invalid" do expect { @product_file.send_to_kindle("example@example.org") }.to raise_error(ArgumentError).wit...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/elasticsearch_model_async_callbacks_spec.rb
spec/modules/elasticsearch_model_async_callbacks_spec.rb
# frozen_string_literal: true describe ElasticsearchModelAsyncCallbacks do before do @model = create_mock_model @model.include(described_class) @model.const_set("ATTRIBUTE_TO_SEARCH_FIELDS", "title" => "title") @multiplier = 2 # we're queuing index and updates jobs twice to mitigate replica lag issue...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/obfuscate_ids_spec.rb
spec/modules/obfuscate_ids_spec.rb
# frozen_string_literal: true require "spec_helper" describe "ObfuscateIds" do let(:raw_id) { Faker::Number.number(digits: 10) } it "decrypts the id correctly" do encrypted_id = ObfuscateIds.encrypt(raw_id) expect(encrypted_id).to_not eq raw_id.to_s encrypted_id_without_padding = ObfuscateIds.encryp...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/immutable_spec.rb
spec/modules/immutable_spec.rb
# frozen_string_literal: true require "spec_helper" describe Immutable do let(:today) { Date.today } # This can be any model, but I'm using the UserComplianceInfo model for the tests. I could not # find a way to create a mock model which included JsonData. let(:model) do build(:user_compliance_info) en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/with_file_properties_spec.rb
spec/modules/with_file_properties_spec.rb
# frozen_string_literal: true require "spec_helper" describe WithFileProperties do PROPERTIES = %i[size duration width height framerate bitrate pagelength].freeze def stub_for_word_doc output_double = double allow(output_double).to receive(:output).and_return("Number of Pages = 2") allow(Subexec).to ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/money_formatter_spec.rb
spec/modules/money_formatter_spec.rb
# frozen_string_literal: true describe MoneyFormatter do describe "#format" do describe "usd" do it "returns the correct string" do expect(MoneyFormatter.format(400, :usd)).to eq "$4.00" end it "returns correctly when no symbol desired" do expect(MoneyFormatter.format(400, :usd...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/twitter_cards_spec.rb
spec/modules/twitter_cards_spec.rb
# frozen_string_literal: true require "spec_helper" describe TwitterCards, :vcr do describe "#twitter_product_card" do it "renders a bunch of meta tags" do link = build(:product, unique_permalink: "abcABC") metas = TwitterCards.twitter_product_card(link) expect(metas).to match("<meta property=...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/integrations_spec.rb
spec/modules/integrations_spec.rb
# frozen_string_literal: true require "spec_helper" describe Integrations do describe "#find_integration_by_name" do context "when called on a Link record" do # TODO: Change one of the integrations to have a different type after newer ones are added it "returns the first integration of the given typ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/s3_retrievable_spec.rb
spec/modules/s3_retrievable_spec.rb
# frozen_string_literal: true require "spec_helper" describe "S3Retrievable" do let!(:model) do model = create_mock_model do |t| t.string :url end model.attr_accessor :user model.include S3Retrievable model.has_s3_fields :url model end subject(:s3_retrievable_object) do model....
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/subdomain_spec.rb
spec/modules/subdomain_spec.rb
# frozen_string_literal: true require "spec_helper" describe Subdomain do before do @seller1 = create(:user) @seller1.username = "test_user" # old style username @seller1.save(validate: false) @seller2 = create(:user, username: "testuser2") # new style username @seller3 = create(:user, usernam...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/cdn_deletable_spec.rb
spec/modules/cdn_deletable_spec.rb
# frozen_string_literal: true require "spec_helper" describe CdnDeletable do describe ".alive_in_cdn" do it "returns only those records which have `deleted_from_cdn_at` set to a NULL value" do create(:product_file, deleted_from_cdn_at: Time.current) product_file = create(:product_file) expect...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/stats_spec.rb
spec/modules/product/stats_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Stats do include ManageSubscriptionHelpers describe ".successful_sales_count", :sidekiq_inline, :elasticsearch_wait_for_refresh do it "does not take into account refunded/disputed purchases" do @product = create(:product, price_cents...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/preview_spec.rb
spec/modules/product/preview_spec.rb
# frozen_string_literal: true require "spec_helper" def uploaded_file(name) Rack::Test::UploadedFile.new(Rails.root.join("spec", "support", "fixtures", name), MIME::Types.type_for(name).first) end describe Product::Preview do before do @bad_file = uploaded_file("other.garbage") @jpg_file = uploaded_file(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/recommendations_spec.rb
spec/modules/product/recommendations_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Recommendations, :elasticsearch_wait_for_refresh do before do @product = create(:product, user: create(:compliant_user, name: "Some creator person"), taxonomy: create(:taxonomy)) end it "is true if has recent sale" do create(:purchas...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/creation_limit_spec.rb
spec/modules/product/creation_limit_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::CreationLimit, :enforce_product_creation_limit do let(:non_compliant_user) { create(:user, user_risk_state: "not_reviewed") } let(:compliant_user) { create(:user, user_risk_state: "compliant") } context "for non-compliant users" do it "p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/prices_spec.rb
spec/modules/product/prices_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Prices do before do @product = create(:product, price_cents: 2_50) @subscription_product = create(:subscription_product, price_cents: 4_00) @subscription_price = @subscription_product.prices.find_by!(recurrence: BasePrice::Recurrence...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/review_stat_spec.rb
spec/modules/product/review_stat_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::ReviewStat do before do @product = create(:product) end context "when the product_review_stat record exists" do before do purchase_1 = create(:purchase, link: @product) @review_1 = create(:product_review, purchase: purcha...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/utils_spec.rb
spec/modules/product/utils_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Utils do describe ".f" do it "fetches product from unique permalink" do product = create(:product) expect(Link.f(product.unique_permalink)).to eq(product) end it "fetches product from custom permalink" do product =...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/caching_spec.rb
spec/modules/product/caching_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Caching do describe "#invalidate_cache" do before do @product = create(:product) Rails.cache.write(@product.scoped_cache_key("en"), "<html>hello</html>") @product.product_cached_values.create! @other_product = create(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/searchable/search_spec.rb
spec/modules/product/searchable/search_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Product::Searchable - Search scenarios" do before do @product = create(:product_with_files) end describe "Elasticsearch `search`" do describe "on indexed products with price values" do before do @creator = create(:recommendable...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/searchable/filtered_search_spec.rb
spec/modules/product/searchable/filtered_search_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Product::Searchable - Filtered search scenarios" do describe "filters adult products for recommendable products" do before do @creator = create(:recommendable_user, username: "a" + SecureRandom.random_number(1e15).round.to_s, name: "Gumbot") ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/searchable/offer_codes_spec.rb
spec/modules/product/searchable/offer_codes_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Product::Searchable - Offer codes filtering" do describe "filtering by offer_codes", :elasticsearch_wait_for_refresh do before do Link.__elasticsearch__.create_index!(force: true) Feature.activate(:offer_codes_search) @creator = c...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/searchable/indexing_spec.rb
spec/modules/product/searchable/indexing_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Product::Searchable - Indexing scenarios" do before do @product = create(:product_with_files) end describe "#as_indexed_json" do it "includes all properties" do taxonomy = create(:taxonomy) @product.update!(name: "Searching for R...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/product/searchable/name_field_search_spec.rb
spec/modules/product/searchable/name_field_search_spec.rb
# frozen_string_literal: true require "spec_helper" describe "Product::Searchable - Name fields search scenarios" do before do @product = create(:product_with_files) end describe "on name fields for all products", :elasticsearch_wait_for_refresh do before do Link.__elasticsearch__.create_index!(f...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/risk_spec.rb
spec/modules/user/risk_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Risk do describe "#disable_refunds!" do before do @creator = create(:user) end it "disables refunds for the creator" do @creator.disable_refunds! expect(@creator.reload.refunds_disabled?).to eq(true) end end d...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/stats_spec.rb
spec/modules/user/stats_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Stats, :vcr do before do @user = create(:user, timezone: "London") end describe "scopes" do describe ".by_sales_revenue" do it "excludes not_charged purchases from revenue total" do product = create(:product, user: @user) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/async_devise_notification_spec.rb
spec/modules/user/async_devise_notification_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::AsyncDeviseNotification do include ActiveJob::TestHelper # The methods in this module are private/protected so they aren't tested. # Instead, the methods which they affect are tested. let(:user) { create(:user) } shared_examples_for "an e...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/australian_backtaxes_spec.rb
spec/modules/user/australian_backtaxes_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::AustralianBacktaxes do before :each do @creator = create(:user) end describe "#opted_in_to_australia_backtaxes?" do it "returns false if the creator hasn't opted in" do expect(@creator.opted_in_to_australia_backtaxes?).to eq(false...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/recommendations_spec.rb
spec/modules/user/recommendations_spec.rb
# frozen_string_literal: true require "spec_helper" describe Product::Recommendations, :elasticsearch_wait_for_refresh do context "when user is recommendable" do let(:user) { create(:recommendable_user) } it "is recommendable" do expect(user.recommendable_reasons.values).to all(be true) expect(...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/tier_spec.rb
spec/modules/user/tier_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Tier do describe "tier state machine" do it "upgrades to next tier" do user = create(:user) expect(user.tier).to eq(User::TIER_0) expect(user.upgrade_tier).to eq(true) expect(user.tier).to eq(User::TIER_1) end it...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/posts_spec.rb
spec/modules/user/posts_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Posts, :freeze_time do describe "visible_posts_for", :vcr do before do @creator = create(:named_user) product = create(:product, name: "product name", user: @creator) product_2 = create(:product, name: "product 2 name", user: @...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/payment_stats_spec.rb
spec/modules/user/payment_stats_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Stats do let(:user) { create(:user) } let(:link) { create(:product, user:) } describe "average_transaction_amount_cents" do describe "no sales" do it "returns zero" do expect(user.average_transaction_amount_cents).to eq(0) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/devise_internal_spec.rb
spec/modules/user/devise_internal_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::DeviseInternal do before do @user = create(:user, confirmed_at: nil) end describe "#confirmation_required?" do it "returns true if email is required" do allow(@user).to receive(:email_required?).and_return(true) allow(@user)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/compliance_spec.rb
spec/modules/user/compliance_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::Compliance do describe "native_payouts_supported?" do it "returns true for US, CA, AU, and UK creators" do %w(US CA AU GB).each do |country_code| creator = create(:user) create(:user_compliance_info_empty, user: creator, co...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/social_twitter_spec.rb
spec/modules/user/social_twitter_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::SocialTwitter do describe "#twitter_picture_url", :vcr do before do data = JSON.parse(File.open("#{Rails.root}/spec/support/fixtures/twitter_omniauth.json").read)["extra"]["raw_info"] @user = create(:user, twitter_user_id: data["id"]...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/feature_status_spec.rb
spec/modules/user/feature_status_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::FeatureStatus do describe "#merchant_migration_enabled?" do it "returns true if either feature flag is enabled of else false" do creator = create(:user) create(:user_compliance_info, user: creator) expect(creator.merchant_migr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/money_balance_spec.rb
spec/modules/user/money_balance_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::MoneyBalance do before :each do @user = create(:user) end describe "#unpaid_balance_cents" do context "via SQL" do it "returns sum of unpaid balance in cents" do create(:balance, user: @user, amount_cents: 100, state: "unp...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/social_google_spec.rb
spec/modules/user/social_google_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::SocialGoogle do before(:all) do @data = JSON.parse(File.open("#{Rails.root}/spec/support/fixtures/google_omniauth.json").read) end describe ".find_or_create_for_google_oauth2" do before do @dataCopy1 = @data.deep_dup @dataCo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/payout_schedule_spec.rb
spec/modules/user/payout_schedule_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::PayoutSchedule do describe "#next_payout_date" do let(:user) { create(:user, payment_address: "bob1@example.com") } context "when payout frequency is weekly" do it "returns the correct next payout date" do travel_to(Date.new(2...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/user/ping_notification_spec.rb
spec/modules/user/ping_notification_spec.rb
# frozen_string_literal: true require "spec_helper" describe User::PingNotification do describe "#send_test_ping" do before do @user = create(:user) @purchase = create(:purchase, seller: @user, link: create(:product, user: @user)) @ping_params = @purchase.payload_for_ping_notification.merge(te...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/shipping_destination/destinations_spec.rb
spec/modules/shipping_destination/destinations_spec.rb
# frozen_string_literal: true require "spec_helper" describe ShippingDestination::Destinations do describe ".shipping_countries" do it "returns the expected shipping countries" do expect(ShippingDestination::Destinations.shipping_countries).to eq(shipping_countries_expected) end end describe ".eu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/subscription/ping_notification_spec.rb
spec/modules/subscription/ping_notification_spec.rb
# frozen_string_literal: true require "spec_helper" describe Subscription::PingNotification do describe "#payload_for_ping_notification" do let(:purchase) { create(:membership_purchase) } let(:subscription) { purchase.subscription } it "contains subscription details" do params = subscription.payl...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/payment/stats_spec.rb
spec/modules/payment/stats_spec.rb
# frozen_string_literal: true require "spec_helper" describe Payment::Stats, :vcr do describe "revenue_by_link" do before do @user = create(:singaporean_user_with_compliance_info, user_risk_state: "compliant", payment_address: "bob@cat.com") @json = JSON.parse(File.open("#{Rails.root}/spec/support/f...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/balance/searchable_spec.rb
spec/modules/balance/searchable_spec.rb
# frozen_string_literal: true require "spec_helper" describe Balance::Searchable do it "includes ElasticsearchModelAsyncCallbacks" do expect(Balance).to include(ElasticsearchModelAsyncCallbacks) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/purchase/risk_spec.rb
spec/modules/purchase/risk_spec.rb
# frozen_string_literal: true require "spec_helper" describe Purchase::Risk do before do Feature.activate(:purchase_check_for_fraudulent_ips) end describe "check purchase for previous chargebacks" do it "returns errors if the email has charged-back" do product = create(:product) product_2 =...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/purchase/reviews_spec.rb
spec/modules/purchase/reviews_spec.rb
# frozen_string_literal: true require "spec_helper" describe Purchase::Reviews do describe "#post_review" do context "non-recurring purchase" do let!(:purchase) { create(:purchase) } context "when there is an existing product_review" do let!(:existing_product_review) { create(:product_revie...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/purchase/accounting_spec.rb
spec/modules/purchase/accounting_spec.rb
# frozen_string_literal: true require "spec_helper" describe Purchase::Accounting do describe "#price_dollars" do it "returns price_cents in dollars" do purchase = create(:purchase) allow(purchase).to receive(:price_cents).and_return(1234) expect(purchase.price_dollars).to eq(12.34) end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/purchase/targeting_spec.rb
spec/modules/purchase/targeting_spec.rb
# frozen_string_literal: true require "spec_helper" describe Purchase::Targeting do before do @seller = create(:user) @product = create(:product, user: @seller) @product2 = create(:product, user: @seller) @product3 = create(:product, user: @seller) @purchase1 = create(:purchase, price_cents: 500...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/modules/purchase/ping_notification_spec.rb
spec/modules/purchase/ping_notification_spec.rb
# frozen_string_literal: true require "spec_helper" describe Purchase::PingNotification, :vcr do describe "#payload_for_ping_notification" do it "contains the correct resource_name" do purchase = create(:purchase, stripe_refunded: true) [ResourceSubscription::SALE_RESOURCE_NAME, ResourceSubscriptio...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/payouts/payout_estimates_spec.rb
spec/business/payments/payouts/payout_estimates_spec.rb
# frozen_string_literal: true require "spec_helper" describe PayoutEstimates do describe "estimate_held_amount_cents" do let(:payout_date) { Date.today - 1 } let(:payout_processor_type) { PayoutProcessorType::STRIPE } # user who has some balances in the payout period and out of it let(:u0) { create...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/payouts/payouts_spec.rb
spec/business/payments/payouts/payouts_spec.rb
# frozen_string_literal: true require "spec_helper" describe Payouts do describe "is_user_payable" do let(:payout_date) { Date.today - 1 } it "returns false for creators with paused payouts" do creator = create(:user, payment_address: "payme@example.com", payouts_paused_internally: true) create...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/payouts/processor/stripe/stripe_payout_processor_spec.rb
spec/business/payments/payouts/processor/stripe/stripe_payout_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe StripePayoutProcessor, :vcr do include CurrencyHelper include StripeChargesHelper describe "is_user_payable" do before do # sufficient balance for US USD payout @u1 = create(:compliant_user, unpaid_balance_cents: 10_01) @m1 = cr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/payouts/processor/paypal/paypal_payout_processor_spec.rb
spec/business/payments/payouts/processor/paypal/paypal_payout_processor_spec.rb
# frozen_string_literal: true require "spec_helper" describe PaypalPayoutProcessor do describe "is_user_payable" do let(:user) { create(:singaporean_user_with_compliance_info, payment_address: "seller@gr.co") } describe "creator has not set a payment address" do before do user.update!(payment...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/spec/business/payments/integrations/paypal_integration_rest_api_spec.rb
spec/business/payments/integrations/paypal_integration_rest_api_spec.rb
# frozen_string_literal: true describe PaypalIntegrationRestApi, :vcr do before do @creator = create(:user, email: "sb-oy4cl2265599@business.example.com") end describe "create_partner_referral" do context "valid inputs" do before do authorization_header = PaypalPartnerRestCredentials.new.a...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false