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
config/initializers/content_security_policy.rb
Ruby
mit
8,966
main
1,102
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. # See the Securing Rails Applications Guide for more information: # https://guides.rubyonrails.org/security.html#content-security-policy-header # Rails.application.configure...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/initializers/application_controller_renderer.rb
Ruby
mit
8,966
main
247
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/initializers/iras.rb
Ruby
mit
8,966
main
519
# frozen_string_literal: true # IRAS gives us two sets of credentials — one for Sandbox, and one for Production. # We're using the Production set in production, and the Sandbox set everywhere else. IRAS_API_ID = GlobalConfig.get("IRAS_API_ID") IRAS_API_SECRET = GlobalConfig.get("IRAS_API_SECRET") if Rails.env.product...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/initializers/cdn_url_map.rb
Ruby
mit
8,966
main
2,124
# frozen_string_literal: true # Map of origin prefixes to determine if a url is hosted at a location fronted by a CDN. # Use cdn_url_for in ProductsHelper to get the CDN url for a url on an origin contained in the map. # Should not be used to replace the use of asset_host. Should only be used for converting URLs persi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/initializers/form_tag_helper.rb
Ruby
mit
8,966
main
354
# frozen_string_literal: true ActionView::Helpers::CsrfHelper.class_eval do def csrf_meta_tags return unless protect_against_forgery? [ tag(:meta, name: "csrf-param", content: request_forgery_protection_token), tag(:meta, name: "csrf-token", content: ApplicationController::TOKEN_PLACEHOLDER) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/environments/production.rb
Ruby
mit
8,966
main
4,630
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/environments/staging.rb
Ruby
mit
8,966
main
4,814
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/environments/test.rb
Ruby
mit
8,966
main
2,899
# frozen_string_literal: true require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
config/environments/development.rb
Ruby
mit
8,966
main
3,358
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response ti...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/spec_helper.rb
Ruby
mit
8,966
main
23,446
# frozen_string_literal: true ENV["RAILS_ENV"] = "test" BUILDING_ON_CI = !ENV["CI"].nil? require File.expand_path("../config/environment", __dir__) require "capybara/rails" require "capybara/rspec" require "rspec/rails" require "paper_trail/frameworks/rspec" require "pundit/rspec" require "faker" Dir.glob(Rails.root...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/factory_bot_linting_spec.rb
Ruby
mit
8,966
main
200
# frozen_string_literal: true require "support/factory_bot_linting.rb" RSpec.describe FactoryBotLinting do it "#process" do expect { described_class.new.process }.to_not raise_error end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/application_helper_spec.rb
Ruby
mit
8,966
main
2,210
# frozen_string_literal: true require "spec_helper" describe ApplicationHelper do describe "#current_user_props" do let(:admin) { create(:admin_user, username: "gumroadian") } let(:seller) { create(:named_seller) } it "returns the current user props" do expect(current_user_props(admin, seller)).t...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/payouts_helper_spec.rb
Ruby
mit
8,966
main
21,937
# frozen_string_literal: true require "spec_helper" describe PayoutsHelper do def verify_balance(user, expected_balance) expect(user.unpaid_balance_cents).to eq expected_balance end describe "formatted_payout_date" do before do @user = create(:singaporean_user_with_compliance_info, payment_addres...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/mailer_helper_spec.rb
Ruby
mit
8,966
main
545
# frozen_string_literal: true require "spec_helper" describe MailerHelper do describe "#from_email_address_name" do context "when name doesn't contain special characters" do it "returns the name" do expect(from_email_address_name("John The Creator")).to eq("John The Creator") end end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/button_helper_spec.rb
Ruby
mit
8,966
main
665
# frozen_string_literal: true require "spec_helper" describe ButtonHelper do describe "#navigation_helper" do it "renders button without options" do output = navigation_button("New product", new_product_path) expect(output).to eq('<a class="button accent" href="/products/new">New product</a>') e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/preorder_helper_spec.rb
Ruby
mit
8,966
main
2,538
# frozen_string_literal: true require "spec_helper" describe PreorderHelper do describe "formatter release time in the seller's timezone" do it "returns the proper date based on the timezone" do release_at = DateTime.parse("Aug 3rd 2018 11AM") seller_timezone = "Pacific Time (US & Canada)" exp...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/signed_url_helper_spec.rb
Ruby
mit
8,966
main
6,362
# frozen_string_literal: true require "spec_helper" describe SignedUrlHelper do let(:pdf_path) { "attachments/23b2d41ac63a40b5afa1a99bf38a0982/original/nyt.pdf" } let(:pdf_uri) { URI.parse("#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/#{pdf_path}").to_s } let(:s3_object_double) { double(:s3_object) } let!(:file) { create(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/users_helper_spec.rb
Ruby
mit
8,966
main
1,688
# frozen_string_literal: true require "spec_helper" describe UsersHelper do describe "#allowed_avatar_extensions" do it "returns supported profile picture extensions separated by comma" do extensions = User::ALLOWED_AVATAR_EXTENSIONS.map { |extension| ".#{extension}" }.join(",") expect(helper.allowe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/affiliates_helper_spec.rb
Ruby
mit
8,966
main
662
# frozen_string_literal: true require "spec_helper" describe AffiliatesHelper do describe "#affiliate_products_select_data" do let(:product) { create(:product) } let(:products) do [create(:product), product, create(:product)] end let(:direct_affiliate) { create(:direct_affiliate, products: [pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/card_params_helper_spec.rb
Ruby
mit
8,966
main
2,483
# frozen_string_literal: true require "spec_helper" describe CardParamsHelper do describe ".get_card_data_handling_mode" do describe "with valid mode" do let(:params) { { card_data_handling_mode: "stripejs.0" } } it "returns the mode" do expect(CardParamsHelper.get_card_data_handling_mode(p...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/social_share_url_helper_spec.rb
Ruby
mit
8,966
main
978
# frozen_string_literal: true require "spec_helper" describe SocialShareUrlHelper do describe "#twitter_url" do it "generates twitter share url" do twitter_url = "https://twitter.com/intent/tweet?text=You+%26+I:%20https://example.com" expect(helper.twitter_url("https://example.com", "You & I")).to e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/installments_helper_spec.rb
Ruby
mit
8,966
main
710
# frozen_string_literal: true require "spec_helper" describe InstallmentsHelper do describe "#post_title_displayable" do let(:url) { nil } let(:post) { create(:installment) } subject { helper.post_title_displayable(post:, url:) } context "when url is missing" do it "displays the post title a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/infos_helper_spec.rb
Ruby
mit
8,966
main
796
# frozen_string_literal: true require "spec_helper" describe InfosHelper do describe "#pagelength_displayable" do let(:pagelength) { 100 } context "when filetype is 'epub'" do it "returns a string indicating the number of sections" do allow(helper).to receive(:pagelength).and_return(pagelengt...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/products_helper_spec.rb
Ruby
mit
8,966
main
8,067
# frozen_string_literal: true require "spec_helper" describe ProductsHelper do describe "#view_content_button_text" do it "shows the custom button text when available" do product = create(:product) product.custom_view_content_button_text = "Custom Text" product.save! expect(product.custo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/currency_helper_spec.rb
Ruby
mit
8,966
main
5,834
# frozen_string_literal: true require "spec_helper" describe CurrencyHelper do describe "#get_rate" do it "returns the correct value" do expect(get_rate("JPY")).to eq "78.3932" expect(get_rate("GBP")).to eq "0.652571" end end describe "#get_usd_cents" do it "converts money amounts corre...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/cdn_url_helper_spec.rb
Ruby
mit
8,966
main
436
# frozen_string_literal: true require "spec_helper" describe CdnUrlHelper do before do stub_const("CDN_URL_MAP", { "#{AWS_S3_ENDPOINT}/gumroad/" => "https://static-2.gumroad.com/res/gumroad/" }) end describe "#cdn_url_for" do it "returns CDN URL" do s3_url = "#{AWS_S3_ENDPOINT}/gumroad/sample.pn...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/helpers/products_helper/offer_codes_spec.rb
Ruby
mit
8,966
main
2,920
# frozen_string_literal: true require "spec_helper" describe ProductsHelper, "url_for_product_page with offer codes" do include Rails.application.routes.url_helpers let(:creator) { create(:user, name: "Testy", username: "testy") } let(:product) { create(:product, unique_permalink: "test", name: "hello", user: ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/routing/api_internal_admin_contract_spec.rb
Ruby
mit
8,966
main
841
# frozen_string_literal: true require "spec_helper" describe "internal admin API routing" do def route_for(path, method) Rails.application.routes.recognize_path("https://#{API_DOMAIN}#{path}", method:) end it "routes the safe read endpoints that gumroad-cli consumes" do expect(route_for("/internal/admi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/routing/api_internal_helper_contract_spec.rb
Ruby
mit
8,966
main
2,405
# frozen_string_literal: true require "spec_helper" describe "legacy internal helper admin routes" do def route_for(path, method) Rails.application.routes.recognize_path("https://#{API_DOMAIN}#{path}", method:) end [ [:post, "/internal/helper/users/create_appeal", "api/internal/helper/users", "create_a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/mock_table_helpers.rb
Ruby
mit
8,966
main
1,153
# frozen_string_literal: true module MockTableHelpers def create_mock_model(name: "MockModel#{SecureRandom.hex(6)}", constantize: true, &block) table_name = "#{name.tableize}_#{SecureRandom.hex}" model = Class.new(ApplicationRecord) model.define_singleton_method(:name) { name } model.table_name = tab...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/overlay_helpers.rb
Ruby
mit
8,966
main
2,452
# frozen_string_literal: true module OverlayHelpers def setup_overlay_data @creator = create(:user) @products = { thank_you: create(:product, price_cents: 8353, user: @creator, name: "Thank you - The Works of Edgar Gumstein"), offer_code: create(:product, user: @creator, price_cents: 700), ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_file_list_helpers.rb
Ruby
mit
8,966
main
4,053
# frozen_string_literal: true # Helper methods for the new file list on the product edit page # (do not use when on the product creation step) module ProductFileListHelpers def have_file_row(name:, count: nil) options = { text: name, exact_text: true, count: }.compact have_selector("[aria-label=Files] [role=...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/email_helpers.rb
Ruby
mit
8,966
main
620
# frozen_string_literal: true module EmailHelpers def upload_attachment(name, wait_until_uploaded: true) attach_file("Attach files", file_fixture(name), visible: false) expect(page).to have_button("Save", disabled: false) if wait_until_uploaded end def find_attachment(name) within "[aria-label='File...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_card_helpers.rb
Ruby
mit
8,966
main
820
# frozen_string_literal: true module ProductCardHelpers def find_product_card(product) page.find("article", text: product.name) end def expect_product_cards_in_order(products) expect(page).to have_product_card(count: products.length) products.each_with_index { |product, index| expect(page).to have_s...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_payment_method_helper.rb
Ruby
mit
8,966
main
5,179
# frozen_string_literal: true module StripePaymentMethodHelper EXPIRY_MM = "12" EXPIRY_YYYY = Time.current.strftime("%Y") EXPIRY_YY = Time.current.strftime("%y") EXPIRY_MMYY = "#{EXPIRY_MM}/#{EXPIRY_YY}" module ExtensionMethods def to_stripe_card_hash { token: self[:token] } end def to_st...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_merchant_account_helper.rb
Ruby
mit
8,966
main
2,335
# frozen_string_literal: true module StripeMerchantAccountHelper MAX_ATTEMPTS_TO_WAIT_FOR_CAPABILITIES = 12 # x 10s = 2 mins module_function def create_verified_stripe_account(params = {}) default_params = DefaultAccountParamsBuilderService.new(country: params[:country]).perform stripe_account = Stripe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/rich_text_editor_helpers.rb
Ruby
mit
8,966
main
1,348
# frozen_string_literal: true module RichTextEditorHelpers def set_rich_text_editor_input(node, to_text:) node.native.clear node.base.send_keys(to_text) end def rich_text_editor_select_all(node) node.native.send_keys(ctrl_key, "a") end def drag_file_embed_to(name:, to:) file_embed = find_em...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/default_account_params_builder_service.rb
Ruby
mit
8,966
main
3,944
# frozen_string_literal: true class DefaultAccountParamsBuilderService def initialize(country: "US") @country = country @default_currency = case country when "CA" Currency::CAD when "US" Currency::USD ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/secure_headers_helpers.rb
Ruby
mit
8,966
main
611
# frozen_string_literal: true module SecureHeadersHelpers def set_nonce_in_script_src_csp(nonce_value) new_config = SecureHeaders::Configuration.dup new_config.csp.script_src << "'nonce-#{nonce_value}'" SecureHeaders::Configuration.instance_variable_set("@default_config", new_config) end def remove_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/capybara_helpers.rb
Ruby
mit
8,966
main
2,955
# frozen_string_literal: true module CapybaraHelpers def wait_for_valid(javascript_expression) page.document.synchronize do raise Capybara::ElementNotFound unless page.evaluate_script(javascript_expression) end end def wait_for_visible(selector) wait_for_valid %($('#{selector}:visible').length...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/rspec_matchers.rb
Ruby
mit
8,966
main
1,153
# frozen_string_literal: true RSpec::Matchers.define :equal_with_indifferent_access do |expected| match do |actual| actual.with_indifferent_access == expected.with_indifferent_access end failure_message do |actual| <<-EOS expected: #{expected} got: #{actual} EOS end failure_message...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/embed_helpers.rb
Ruby
mit
8,966
main
988
# frozen_string_literal: true module EmbedHelpers def cleanup_embed_artifacts Dir.glob(Rails.root.join("public", "embed_spec_page_*.html")).each { |f| File.delete(f) } end def create_embed_page(product, template_name: "embed_page.html.erb", url: nil, gumroad_params: nil, outbound: true, insert_anchor_tag: t...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/profile_helper.rb
Ruby
mit
8,966
main
518
# frozen_string_literal: true # Helper method to complete user profile fields # Used in auth specs where dashboard and logout option are visible only after profile is filled in module FillInUserProfileHelpers def fill_in_profile visit settings_profile_path fill_in("Username", with: "gumbo") fill_in("Nam...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/capybara_driver.rb
Ruby
mit
8,966
main
5,249
# frozen_string_literal: true webdriver_client = Selenium::WebDriver::Remote::Http::Default.new(open_timeout: 120, read_timeout: 120) Capybara.register_driver :chrome do |app| options = Selenium::WebDriver::Chrome::Options.new options.add_emulation(device_metrics: { width: 1440, height: 900, touch: false }) opt...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_account_stub_helper.rb
Ruby
mit
8,966
main
6,043
# frozen_string_literal: true RSpec.shared_context "with Stripe API stubs" do STRIPE_STUB_POSTAL_CODE_PATTERNS = { "AT" => /\A\d{4}\z/, "AU" => /\A\d{4}\z/, "BE" => /\A\d{4}\z/, "BG" => /\A\d{4}\z/, "BR" => /\A\d{5}-?\d{3}\z/, "CA" => /\A[A-Z]\d[A-Z]\s?\d[A-Z]\d\z/i, "CH" => /\A\d{4}\z/, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/tax_id_validation_stubs.rb
Ruby
mit
8,966
main
1,470
# frozen_string_literal: true module TaxIdValidationStubs def stub_tax_id_validation_services allow_any_instance_of(TaxIdValidationService).to receive(:process) { |service| service.tax_id.present? } allow_any_instance_of(AbnValidationService).to receive(:process) { |service| service.abn_id.present? } all...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_edit_page_helpers.rb
Ruby
mit
8,966
main
321
# frozen_string_literal: true module ProductEditPageHelpers def save_change(expect_alert: true, expect_message: "Changes saved!") click_on "Save changes" wait_for_ajax if expect_alert expect(page).to have_alert(text: expect_message) end expect(page).to have_button "Save changes" end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/checkout_helpers.rb
Ruby
mit
8,966
main
11,779
# frozen_string_literal: true module CheckoutHelpers def add_to_cart(product, cart: false, pwyw_price: nil, option: nil, rent: false, recurrence: nil, logged_in_user: nil, quantity: 1, offer_code: nil, ppp_factor: nil, **params) choose "Rent" if rent && product.purchase_type != "rent_only" choose option == "...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_want_this_helpers.rb
Ruby
mit
8,966
main
381
# frozen_string_literal: true # Helper methods for the "i want this!" container on product and profile pages module ProductWantThisHelpers # in case of a single-tier / single-version-option products, recurrences will be shown as option boxes def select_recurrence_box(recurrence) find(".recurrence-boxes .varian...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/post_helper.rb
Ruby
mit
8,966
main
604
# frozen_string_literal: true # Helper method to upload post files # Used in posts and workflow specs module PostHelpers def upload_post_file(file_name) attach_post_file file_name wait_for_file_upload_to_finish file_name end def attach_post_file(file_name) page.attach_file(file_fixture(file_name)) d...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/manage_subscription_helpers.rb
Ruby
mit
8,966
main
9,620
# frozen_string_literal: true # Helper methods for testing managing subscription functionality module ManageSubscriptionHelpers def shared_setup(originally_subscribed_at: nil, recommendable: false) @email = generate(:email) @user = create(:user, email: @email) @credit_card = create(:credit_card, user: @u...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/geoip_mocking.rb
Ruby
mit
8,966
main
8,673
# frozen_string_literal: true RSpec.configure do |config| config.before(:each) do full_description = RSpec.current_example&.full_description || "" if full_description.include?("invalid UTF-8") || full_description.include?("underlying GEOIP has invalid") allow(GEOIP).to receive(:city).and_return( ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_row_helpers.rb
Ruby
mit
8,966
main
362
# frozen_string_literal: true module ProductRowHelpers def find_product_row(product) find("[role=listitem]", text: product.name) end def drag_product_row(product, to:) product_row = find_product_row(product) to_product_row = find_product_row(to) within product_row do find("[aria-grabbed]")...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/elasticsearch.rb
Ruby
mit
8,966
main
4,334
# frozen_string_literal: true unless ENV["LOG_ES"] == "true" EsClient.transport.logger = Logger.new(File::NULL) end module Elasticsearch::API::Actions alias original_index index def index_and_wait_for_refresh(arguments = {}) arguments[:refresh] = "true" original_index(arguments) end alias original_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_tiered_pricing_helpers.rb
Ruby
mit
8,966
main
390
# frozen_string_literal: true # Helper methods for tiered membership products with tier-level pricing module ProductTieredPricingHelpers def tier_pricing_values(product) product.tier_category.variants.alive.map(&:reload).map do |tier| json = tier.as_json { name: tier.name, pwyw: json["is_customizable...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factory_bot_linting.rb
Ruby
mit
8,966
main
1,529
# frozen_string_literal: true class FactoryBotLinting def process Rails.application.load_seed VCR.turn_on! cassette_options = { match_requests_on: [:method, uri_matcher] } FactoryBot.factories.each do |factory| VCR.use_cassette("factory_linting/factories/#{factory.name}/all_requests", cassett...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_page_view_helpers.rb
Ruby
mit
8,966
main
430
# frozen_string_literal: true module ProductPageViewHelpers def add_page_view(product, timestamp = Time.current.iso8601, extra_body = {}) extra_body[:referrer_domain] = extra_body[:referrer_domain].presence || "direct" EsClient.index( index: ProductPageView.index_name, body: { product_id:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/card_params_spec_helper.rb
Ruby
mit
8,966
main
3,238
# frozen_string_literal: true # A collection of card parameters for the Stripe payment processor. Use these in preference to hardcoding card numbers # into tests where possible, and expand as necessary, ensuring that only cards listed in the Stripe testing # documentation are included in our specs. # Stripe Test Cards...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/product_variants_helpers.rb
Ruby
mit
8,966
main
417
# frozen_string_literal: true # Helper methods for the versions/variants part of the product edit page module ProductVariantsHelpers def version_rows all("[aria-label='Version editor']") end def version_option_rows all("[role=listitem]") end def remove_version_option click_on "Remove version" ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/collab_product_helpers.rb
Ruby
mit
8,966
main
2,295
# frozen_string_literal: true # Helper methods for testing collabs product functionality module CollabProductHelper def setup_collab_purchases_for(user) collaborator = create(:collaborator, affiliate_user: user) collab_product = create(:product, :is_collab, user: collaborator.seller, name: "collab product", ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/puffing_billy.rb
Ruby
mit
8,966
main
926
# frozen_string_literal: true # From https://knapsackpro.com/faq/question/how-to-configure-puffing-billy-gem-with-knapsack-pro-queue-mode # A patch to `puffing-billy`'s proxy so that it doesn't try to stop # eventmachine's reactor if it's not running. module BillyProxyPatch def stop return unless EM.reactor_runn...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_balance_enforcer.rb
Ruby
mit
8,966
main
1,657
# frozen_string_literal: true require_relative "stripe_charges_helper" require_relative "stripe_payment_method_helper" # Ensures that the Stripe test account has a sufficient balance to run the # suite (e.g. instant payout E2E tests). class StripeBalanceEnforcer include StripeChargesHelper # As of July 2025, run...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/helperai_spec_helper.rb
Ruby
mit
8,966
main
334
# frozen_string_literal: true module HelperAISpecHelper def set_headers(params: nil, json: nil) hmac = Helper::Client.new.create_hmac_digest(params:, json:) hmac_base64 = Base64.encode64(hmac) request.headers["Authorization"] = "Bearer #{hmac_base64}" request.headers["Content-Type"] = "application/js...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/aria_extensions.rb
Ruby
mit
8,966
main
14,306
# frozen_string_literal: true Capybara.modify_selector(:button) do expression_filter(:role, default: true) do |xpath| xpath[XPath.attr(:role).equals("button").or ~XPath.attr(:role)] end end Capybara.modify_selector(:link) do expression_filter(:role, default: true) do |xpath| xpath[XPath.attr(:role).equa...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/js_error_reporter.rb
Ruby
mit
8,966
main
5,472
# frozen_string_literal: true class JSErrorReporter def initialize @_ignored_js_errors = [] @source_maps = Hash.new do |hash, key| hash[key] = begin sourcemap_uri = URI.parse(key).tap { |uri| uri.path += ".map" } if sourcemap_uri.path.match?(/\/assets\/application-.*\.js\.map/) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_charges_helper.rb
Ruby
mit
8,966
main
932
# frozen_string_literal: true module StripeChargesHelper def create_stripe_charge(payment_method_id, **charge_params) payment_intent = create_stripe_payment_intent(payment_method_id, **charge_params) Stripe::Charge.retrieve(id: payment_intent.latest_charge) end def create_stripe_payment_intent(payment_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/makara_proxy_extensions.rb
Ruby
mit
8,966
main
681
# frozen_string_literal: true # Inspired by https://github.com/instacart/makara/blob/e45ba090fce998dad9e9a2759426f4695009cfae/spec/support/proxy_extensions.rb module ProxyExtensions attr_reader :primary_pool, :replica_pool, :id def primary_for?(sql) pool_for(sql) == primary_pool end def would_stick?(sql...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/error_responses.rb
Ruby
mit
8,966
main
779
# frozen_string_literal: true # Ref: https://eliotsykes.com/2017/03/08/realistic-error-responses/ # Useful for rendering true 404 responses in request specs, for example. module ErrorResponses def respond_without_detailed_exceptions env_config = Rails.application.env_config original_show_exceptions = env_con...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/circle_rate_limit_stub.rb
Ruby
mit
8,966
main
328
# frozen_string_literal: true RSpec.configure do |config| config.around(:each, :without_circle_rate_limit) do |example| RSpec::Mocks.with_temporary_scope do allow_any_instance_of(CircleApi).to receive(:rate_limited_call).and_wrap_original do |_, &blk| blk.call end example.run end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stripe_retry_helper.rb
Ruby
mit
8,966
main
2,405
# frozen_string_literal: true module StripeRetryHelper MAX_RETRIES = 7 BASE_DELAY = 1.0 class << self def with_retry_on_rate_limit(&block) return yield unless Rails.env.test? return yield if vcr_cassette_active? attempt = 0 begin yield rescue Stripe::InvalidRequestErr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/preview_box_helpers.rb
Ruby
mit
8,966
main
768
# frozen_string_literal: true module PreviewBoxHelpers def in_preview(&block) scroll_to find("aside", text: "Preview") within_section "Preview", section_element: :aside do block.call end end def expect_current_step(step) if step === :product_preview expect(page).to have_selector(".pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/payments_helper.rb
Ruby
mit
8,966
main
899
# frozen_string_literal: true module PaymentsHelper def create_payment_with_purchase(seller, created_at_date, payment_type = :payment_completed, product: nil, amount_cents: nil, ip_country: nil) amount_cents ||= [1000, 2000, 1500].sample product ||= create(:product, user: seller) payment = create( ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/stale_element_retry.rb
Ruby
mit
8,966
main
584
# frozen_string_literal: true # Chrome raises UnknownError instead of StaleElementReferenceError when React # re-renders replace DOM nodes. Capybara retries stale elements automatically # but doesn't recognize Chrome's variant. This patch bridges that gap. module ChromeStaleNodeFix def execute(*) super rescue ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/mail_body_extensions.rb
Ruby
mit
8,966
main
305
# frozen_string_literal: true module MailBodyExtensions def sanitized @_sanitized ||= ActionView::Base.full_sanitizer .sanitize(self.encoded) .gsub("\r\n", " ") .gsub(/\s{2,}/, " ") end end # Extend Mail::Body to include the above module Mail::Body.include(MailBodyExtensions)
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/sales_related_products_infos_helpers.rb
Ruby
mit
8,966
main
245
# frozen_string_literal: true module SalesRelatedProductsInfosHelpers def rebuild_srpis_cache CachedSalesRelatedProductsInfo.delete_all Link.ids.each do UpdateCachedSalesRelatedProductsInfosJob.new.perform(_1) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/user_compliance_infos.rb
Ruby
mit
8,966
main
3,589
# frozen_string_literal: true FactoryBot.define do factory :user_compliance_info_empty, class: UserComplianceInfo do user end factory :user_compliance_info, parent: :user_compliance_info_empty do first_name { "Chuck" } last_name { "Bartowski" } street_address { "address_full_match" } city { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/israel_bank_accounts.rb
Ruby
mit
8,966
main
247
# frozen_string_literal: true FactoryBot.define do factory :israel_bank_account do user account_number { "IL620108000000099999999" } account_number_last_four { "9999" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/post_email_blasts.rb
Ruby
mit
8,966
main
544
# frozen_string_literal: true FactoryBot.define do factory :post_email_blast, aliases: [:blast] do post seller { post.seller } requested_at { 30.minutes.ago } started_at { 25.minutes.ago } first_email_delivered_at { 20.minutes.ago } last_email_delivered_at { 10.minutes.ago } delivery_coun...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/vietnam_bank_accounts.rb
Ruby
mit
8,966
main
266
# frozen_string_literal: true FactoryBot.define do factory :vietnam_bank_account do user account_number { "000123456789" } account_number_last_four { "6789" } bank_code { "01101100" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/liechtenstein_bank_accounts.rb
Ruby
mit
8,966
main
256
# frozen_string_literal: true FactoryBot.define do factory :liechtenstein_bank_account do user account_number { "LI0508800636123378777" } account_number_last_four { "8777" } account_holder_full_name { "Liechtenstein Creator" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/tanzania_bank_accounts.rb
Ruby
mit
8,966
main
273
# frozen_string_literal: true FactoryBot.define do factory :tanzania_bank_account do user account_number { "0000123456789" } account_number_last_four { "6789" } bank_code { "AAAATZTXXXX" } account_holder_full_name { "Tanzanian Creator I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/charge_events.rb
Ruby
mit
8,966
main
1,649
# frozen_string_literal: true FactoryBot.define do factory :charge_event, class: ChargeEvent do skip_create # ChargeEvent is not an ActiveRecord object; does not define "save!" charge_id { "charge-#{Random.rand}" } created_at { DateTime.current } comment { "charge succeeded" } type { ChargeEvent...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/offer_codes.rb
Ruby
mit
8,966
main
1,163
# frozen_string_literal: true FactoryBot.define do factory :offer_code do user products { [FactoryBot.create(:product, user:)] } code { "sxsw" } amount_cents { 1_00 } currency_type { user.currency_type } before(:create) do |offer_code| if offer_code.products.present? offer_code...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/links.rb
Ruby
mit
8,966
main
11,044
# frozen_string_literal: true FactoryBot.define do factory :product, class: Link do name { "The Works of Edgar Gumstein" } description { "This is a collection of works spanning 1984 — 1994, while I spent time in a shack in the Andes." } user { create(:user) } price_cents { 100 } display_product_r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/denmark_bank_accounts.rb
Ruby
mit
8,966
main
243
# frozen_string_literal: true FactoryBot.define do factory :denmark_bank_account do user account_number { "DK5000400440116243" } account_number_last_four { "2874" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/saudi_arabia_bank_accounts.rb
Ruby
mit
8,966
main
286
# frozen_string_literal: true FactoryBot.define do factory :saudi_arabia_bank_account do user account_number { "SA4420000001234567891234" } account_number_last_four { "1234" } bank_code { "RIBLSARIXXX" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/customer_email_infos.rb
Ruby
mit
8,966
main
519
# frozen_string_literal: true FactoryBot.define do factory :customer_email_info do purchase email_name { "receipt" } state { "created" } factory :customer_email_info_sent do state { "sent" } sent_at { Time.current } factory :customer_email_info_delivered do state { "delive...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/variant_prices.rb
Ruby
mit
8,966
main
367
# frozen_string_literal: true FactoryBot.define do factory :variant_price do variant price_cents { 100 } currency { "usd" } recurrence { "monthly" } factory :pwyw_recurring_variant_price do suggested_price_cents { 200 } after(:create) do |price| price.variant.update!(customi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/audience_members.rb
Ruby
mit
8,966
main
1,458
# frozen_string_literal: true FactoryBot.define do factory :audience_member do association :seller, factory: :user email { generate :email } details { {} } transient do purchases { nil } follower { nil } affiliates { nil } end after(:build) do |member, evaluator| if ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/paraguay_bank_accounts.rb
Ruby
mit
8,966
main
265
# frozen_string_literal: true FactoryBot.define do factory :paraguay_bank_account do user account_number { "0567890123456789" } account_number_last_four { "6789" } bank_code { "0" } account_holder_full_name { "Paraguayan Creator" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/collaborators.rb
Ruby
mit
8,966
main
397
# frozen_string_literal: true FactoryBot.define do factory :collaborator do association :affiliate_user, factory: :affiliate_user association :seller, factory: :user apply_to_all_products { true } affiliate_basis_points { 30_00 } trait :with_pending_invitation do collaborator_invitation { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/workflows.rb
Ruby
mit
8,966
main
1,439
# frozen_string_literal: true FactoryBot.define do factory :workflow do association :seller, factory: :user link { create(:product, user: seller) } name { "my workflow" } workflow_type { "product" } workflow_trigger { nil } factory :audience_workflow do workflow_type { Workflow::AUDIEN...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/affiliate_partial_refunds.rb
Ruby
mit
8,966
main
316
# frozen_string_literal: true FactoryBot.define do factory :affiliate_partial_refund do affiliate_credit affiliate_user { affiliate_credit.affiliate_user } seller { affiliate_credit.seller } purchase { affiliate_credit.purchase } affiliate { affiliate_credit.affiliate } balance end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/google_calendar_integrations.rb
Ruby
mit
8,966
main
277
# frozen_string_literal: true FactoryBot.define do factory :google_calendar_integration do calendar_id { "0" } calendar_summary { "Holidays" } access_token { "test_access_token" } refresh_token { "test_refresh_token" } email { "hi@gmail.com" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/product_review_videos.rb
Ruby
mit
8,966
main
269
# frozen_string_literal: true FactoryBot.define do factory :product_review_video do association :product_review approval_status { :pending_review } after(:build) do |video| video.video_file ||= build(:video_file, record: video) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/peru_bank_accounts.rb
Ruby
mit
8,966
main
242
# frozen_string_literal: true FactoryBot.define do factory :peru_bank_account do user account_number { "99934500012345670024" } account_number_last_four { "0024" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/shipping_destinations.rb
Ruby
mit
8,966
main
213
# frozen_string_literal: true FactoryBot.define do factory :shipping_destination do country_code { Product::Shipping::ELSEWHERE } one_item_rate_cents { 0 } multiple_items_rate_cents { 0 } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/call_availabilities.rb
Ruby
mit
8,966
main
302
# frozen_string_literal: true FactoryBot.define do factory :call_availability do start_time { 1.day.ago } end_time { 1.year.from_now } after(:build) do |call_availability| call_availability.call ||= build(:call_product, call_availabilities: [call_availability]) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/tunisia_bank_accounts.rb
Ruby
mit
8,966
main
249
# frozen_string_literal: true FactoryBot.define do factory :tunisia_bank_account do user account_number { "TN5904018104004942712345" } account_number_last_four { "2345" } account_holder_full_name { "Gumbot Gumstein I" } end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/support/factories/upsells.rb
Ruby
mit
8,966
main
814
# frozen_string_literal: true FactoryBot.define do factory :upsell do name { "Upsell" } seller { create(:user) } product { create(:product, user: seller) } text { "Take advantage of this excellent offer!" } description { "This offer will only last for a few weeks." } cross_sell { false } en...