source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/admin_funds_csv_report_service_spec.rb
Ruby
mit
8,966
main
2,368
# frozen_string_literal: true require "spec_helper" describe AdminFundsCsvReportService do describe ".generate" do subject(:csv_report) { described_class.new(@report).generate } context "for funds received report" do before do @report = FundsReceivedReports.funds_received_report(1, 2022) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/user_balance_stats_service_spec.rb
Ruby
mit
8,966
main
8,234
# frozen_string_literal: true require "spec_helper" describe UserBalanceStatsService do let(:user) { create(:user) } let(:instance) { described_class.new(user:) } let(:example_values) { { foo: "bar", nested: { key1: { key2: "value2" } }, records: [{ id: 1, name: "first" }, { id: 2, name: "second" }] } } desc...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/save_files_service_spec.rb
Ruby
mit
8,966
main
8,728
# frozen_string_literal: true require "spec_helper" describe SaveFilesService do before do @product = create(:product) end subject(:service) { described_class } describe ".perform" do context "when params is empty" do it "does not raise an error" do service.perform(@product, {}) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/url_service_spec.rb
Ruby
mit
8,966
main
6,204
# frozen_string_literal: true require "spec_helper" describe UrlService do describe "#domain_with_protocol" do it "returns domain with protocol" do expect(UrlService.domain_with_protocol).to eq "#{PROTOCOL}://#{DOMAIN}" end end describe "#api_domain_with_protocol" do it "returns domain with p...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/mvn_validation_service_spec.rb
Ruby
mit
8,966
main
3,079
# frozen_string_literal: true require "spec_helper" describe MvaValidationService do before do @vatstack_response = { "id" => "5e5a894fa5807929777ad9c7", "active" => true, "company_address" => "Søndre gate 15, 7011 TRONDHEIM", "company_name" => "DANSKE BANK", "company_type" => "NUF...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/save_installment_service_spec.rb
Ruby
mit
8,966
main
25,180
# frozen_string_literal: true require "spec_helper" describe SaveInstallmentService do let(:seller) { create(:user) } let(:installment) { nil } let(:product) { create(:product, user: seller) } let(:params) do ActionController::Parameters.new( installment: { affiliate_products: nil, a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/zoom_api_spec.rb
Ruby
mit
8,966
main
1,229
# frozen_string_literal: true require "spec_helper" describe ZoomApi do let(:oauth_request_header) do client_id = GlobalConfig.get("ZOOM_CLIENT_ID") client_secret = GlobalConfig.get("ZOOM_CLIENT_SECRET") token = Base64.strict_encode64("#{client_id}:#{client_secret}") { "Authorization" => "Basic #{t...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/google_calendar_api_spec.rb
Ruby
mit
8,966
main
3,174
# frozen_string_literal: true require "spec_helper" describe GoogleCalendarApi do describe "POST oauth_token" do it "makes an oauth authorization request with the given code and redirect uri" do WebMock.stub_request(:post, "#{GoogleCalendarApi::GOOGLE_CALENDAR_OAUTH_URL}/token"). with( b...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product_duplicator_service_spec.rb
Ruby
mit
8,966
main
25,002
# frozen_string_literal: true require "spec_helper" describe ProductDuplicatorService do let(:seller) { create(:user) } let(:s3_url) { "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/magic.mp3" } let(:product) do product_params = { user: seller, price_cents: 5000, name: "test product", descrip...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/offer_code_discount_computing_service_spec.rb
Ruby
mit
8,966
main
13,849
# frozen_string_literal: true require "spec_helper" describe OfferCodeDiscountComputingService do let(:seller) { create(:user) } let(:product) { create(:product, user: seller, price_cents: 2000, price_currency_type: "usd") } let(:product2) { create(:product, user: seller, price_cents: 2000, price_currency_type:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/features_markdown_generator_spec.rb
Ruby
mit
8,966
main
1,146
# frozen_string_literal: true require "spec_helper" describe FeaturesMarkdownGenerator do describe ".call" do it "returns markdown containing all feature categories" do result = described_class.call expect(result).to include("# Gumroad features") expect(result).to include("## Products") ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/safe_redirect_path_service_spec.rb
Ruby
mit
8,966
main
2,896
# frozen_string_literal: true require "spec_helper" describe "SafeRedirectPathService" do before do @request = OpenStruct.new(host: "test.gumroad.com") end let(:service) { SafeRedirectPathService.new(@path, @request) } describe "#process" do context "when path has a subdomain host" do before d...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/forfeit_balance_service_spec.rb
Ruby
mit
8,966
main
4,450
# frozen_string_literal: true require "spec_helper" describe ForfeitBalanceService do let(:user) { create(:named_user) } let(:merchant_account) { create(:merchant_account, user:, charge_processor_id: StripeChargeProcessor.charge_processor_id) } context "country_change" do before do @service = Forfeit...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/subdomain_redirector_service_spec.rb
Ruby
mit
8,966
main
3,319
# frozen_string_literal: true require "spec_helper" describe SubdomainRedirectorService do let(:service) { described_class.new } describe "#update" do it "sets the config in redis" do config = "live.gumroad.com=example.com\ntwitter.gumroad.com=twitter.com/gumroad" service.update(config) re...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/user_custom_domain_request_service_spec.rb
Ruby
mit
8,966
main
1,646
# frozen_string_literal: true describe UserCustomDomainRequestService do describe "#valid?" do let(:request) { double("request") } it "returns false when request is from Gumroad domain" do allow(request).to receive(:host).and_return("app.test.gumroad.com") expect(UserCustomDomainRequestService.v...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/username_generator_service_spec.rb
Ruby
mit
8,966
main
4,313
# frozen_string_literal: true require "spec_helper" describe UsernameGeneratorService do describe "#username" do let(:user) { build(:user, email: "johnsmith@gmail.com") } let(:username_generator) { described_class.new(user) } it "returns a username generated by OpenAI", :vcr do expect(username_ge...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/discord_api_spec.rb
Ruby
mit
8,966
main
749
# frozen_string_literal: true require "spec_helper" describe DiscordApi do describe "POST oauth_token" do it "makes an oauth authorization request with the given code and redirect uri" do WebMock.stub_request(:post, DISCORD_OAUTH_TOKEN_URL). with( body: { grant_type: "authori...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/kra_pin_validation_service_spec.rb
Ruby
mit
8,966
main
827
# frozen_string_literal: true require "spec_helper" describe KraPinValidationService do it "returns true when valid KRA PIN is provided" do kra_pin = "A123456789P" expect(described_class.new(kra_pin).process).to be(true) end it "returns false when nil KRA PIN is provided" do expect(described_class....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/stripe_tax_forms_api_spec.rb
Ruby
mit
8,966
main
2,673
# frozen_string_literal: true require "spec_helper" describe StripeTaxFormsApi, vcr: { cassette_name: "StripeTaxFormsApi/tax_forms" } do let(:stripe_account_id) { "acct_1234567890" } let(:form_type) { "us_1099_k" } let(:year) { 2024 } let(:service) { described_class.new(stripe_account_id:, form_type:, year:) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/merge_carts_service_spec.rb
Ruby
mit
8,966
main
3,949
# frozen_string_literal: true require "spec_helper" describe MergeCartsService do describe "#process" do let!(:user) { create(:user) } let(:browser_guid) { SecureRandom.uuid } context "when source cart is nil" do it "updates the details of the target cart" do cart = create(:cart, user:, b...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/rpush_apns_app_service_spec.rb
Ruby
mit
8,966
main
3,002
# frozen_string_literal: true require "spec_helper" describe RpushApnsAppService do let!(:app_name) { Device::APP_TYPES[:creator] } let(:mock_certificate) do key = OpenSSL::PKey::RSA.new(2048) cert = OpenSSL::X509::Certificate.new cert.version = 2 cert.serial = 1 cert.subject = OpenSSL::X509...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/gumroad_daily_analytics_compiler_spec.rb
Ruby
mit
8,966
main
12,291
# frozen_string_literal: true require "spec_helper" describe GumroadDailyAnalyticsCompiler do describe ".compile_gumroad_price_cents" do it "aggregates data for the dates provided" do create :purchase, created_at: Time.utc(2023, 1, 4) create :purchase, created_at: Time.utc(2023, 1, 5) create :...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/black_friday_stats_service_spec.rb
Ruby
mit
8,966
main
2,430
# frozen_string_literal: true require "spec_helper" describe BlackFridayStatsService do describe ".calculate_stats" do it "returns placeholder values with zero counts" do stats = described_class.calculate_stats expect(stats[:active_deals_count]).to eq(0) expect(stats[:revenue_cents]).to eq(0)...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/circle_api_spec.rb
Ruby
mit
8,966
main
12,944
# frozen_string_literal: true require "spec_helper" describe CircleApi, :vcr, :without_circle_rate_limit do let(:communities_list) do [ { "id" => 3512, "name" => "Gumroad", "slug" => "gumroad", "icon_url" => "https://d2y5h3osumboay.cloudfront.net/o4431o822um5prcmyefm7pc9fhht", "log...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/save_public_files_service_spec.rb
Ruby
mit
8,966
main
5,026
# frozen_string_literal: true require "spec_helper" describe SavePublicFilesService do let(:seller) { create(:user) } let(:product) { create(:product, user: seller) } let!(:public_file1) { create(:public_file, :with_audio, resource: product, display_name: "Audio 1") } let!(:public_file2) { create(:public_file...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/email_suppression_manager_spec.rb
Ruby
mit
8,966
main
2,093
# frozen_string_literal: true require "spec_helper" describe EmailSuppressionManager, :vcr do let(:email) { "sam@example.com" } describe "#unblock_email" do let(:lists) { [:bounces, :spam_reports] } it "scans all lists even if the email is found in one of the lists in between" do allow_any_instanc...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/post_email_api_spec.rb
Ruby
mit
8,966
main
8,987
# frozen_string_literal: true require "spec_helper" describe PostEmailApi do let(:seller) { create(:named_user) } let(:post) { create(:audience_installment, seller: seller) } let(:recipients) do 10.times.map { |i| { email: "recipient#{i}@gumroad-example.com" } } end let(:args) { { post: post, recipients...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/sitemap_service_spec.rb
Ruby
mit
8,966
main
888
# frozen_string_literal: true require "spec_helper" describe SitemapService do let(:service) { described_class.new } describe "#generate" do before do @product = create(:product, created_at: Time.current) end it "generates the sitemap" do date = @product.created_at sitemap_file_pat...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/payout_users_service_spec.rb
Ruby
mit
8,966
main
15,572
# frozen_string_literal: true require "spec_helper" describe PayoutUsersService, :vcr do let!(:payout_date) { Date.yesterday } let(:user1) { create(:user, should_paypal_payout_be_split: true) } let(:user2) { create(:user) } before do create(:tos_agreement, user: user1) create(:user_compliance_info, u...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchasing_power_parity_service_spec.rb
Ruby
mit
8,966
main
2,276
# frozen_string_literal: true require "spec_helper" describe PurchasingPowerParityService do before do @namespace = Redis::Namespace.new(:ppp, redis: $redis) @service = described_class.new @seller = create(:user) end describe "#get_factor" do before do @namespace.set("FAKE", "0.9876543210...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/qst_validation_service_spec.rb
Ruby
mit
8,966
main
1,745
# frozen_string_literal: true require "spec_helper" describe QstValidationService, :vcr do let(:qst_id) { "1002092821TQ0001" } it "returns true when a valid qst id is provided" do expect(described_class.new(qst_id).process).to be(true) end it "returns false when the qst id is nil" do expect(describe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/admin_search_service_spec.rb
Ruby
mit
8,966
main
11,474
# frozen_string_literal: true require "spec_helper" describe AdminSearchService do describe "#search_purchases" do it "returns no Purchases if query is invalid" do purchases = AdminSearchService.new.search_purchases(query: "invalidquery") expect(purchases.size).to eq(0) end it "returns pur...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/post_resend_api_spec.rb
Ruby
mit
8,966
main
17,999
# frozen_string_literal: true require "spec_helper" describe PostResendApi, :freeze_time do include Rails.application.routes.url_helpers before do @seller = create(:named_user) @post = create(:audience_installment, name: "post title", message: "post body", seller: @seller) described_class.mails.clear...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/update_user_compliance_info_spec.rb
Ruby
mit
8,966
main
2,066
# frozen_string_literal: true require "spec_helper" describe UpdateUserComplianceInfo do describe "#process" do let(:user) { create(:user) } context "when individual_tax_id exceeds maximum length" do it "returns an error without attempting RSA encryption" do oversized_tax_id = "1" * 201 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/tax_id_validation_service_spec.rb
Ruby
mit
8,966
main
940
# frozen_string_literal: true require "spec_helper" describe TaxIdValidationService, :vcr do let(:tax_id) { "528491" } let(:country_code) { "IS" } it "returns true when a valid tax id is provided" do expect(described_class.new(tax_id, country_code).process).to be(true) end it "returns false when the t...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/trn_validation_service_spec.rb
Ruby
mit
8,966
main
677
# frozen_string_literal: true require "spec_helper" describe TrnValidationService do it "returns true when valid TRN is provided" do trn_id = "123456789012345" expect(described_class.new(trn_id).process).to be(true) end it "returns false when nil TRN is provided" do expect(described_class.new(nil)....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/expiring_s3_file_service_spec.rb
Ruby
mit
8,966
main
3,240
# frozen_string_literal: true require "spec_helper" describe ExpiringS3FileService do describe "#perform" do before do @file = fixture_file_upload("test.png") stub_const("S3_BUCKET", "gumroad-specs") end it "generates URL with given data and default values" do result = ExpiringS3FileS...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/balances_by_product_service_spec.rb
Ruby
mit
8,966
main
2,777
# frozen_string_literal: true require "spec_helper" describe BalancesByProductService do include CollabProductHelper describe "#process" do let(:user) { create(:user) } before do (0...5).each do |i| product = create(:product, user:, name: "product #{i}", purchase_disabled_at: i == 4 ? Time...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/email_router_fallback_service_spec.rb
Ruby
mit
8,966
main
2,362
# frozen_string_literal: true require "spec_helper" describe EmailRouterFallbackService do let(:user) { create(:user) } before do EmailRouterFallbackService.clear(user:) end describe ".email_provider_for_two_factor" do context "when feature flag is inactive" do before { Feature.deactivate(:res...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/pdf_stamping_service_spec.rb
Ruby
mit
8,966
main
1,707
# frozen_string_literal: true require "spec_helper" describe PdfStampingService do describe ".can_stamp_file?" do let(:product_file) { instance_double("ProductFile") } before do allow(PdfStampingService::Stamp).to receive(:can_stamp_file?).and_return(true) end it "calls can_stamp_file? on Pd...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/paypal_balance_check_service_spec.rb
Ruby
mit
8,966
main
3,771
# frozen_string_literal: true require "spec_helper" describe PaypalBalanceCheckService do before do allow(PaypalPayoutProcessor).to receive(:current_paypal_balance_cents).and_return(current_balance_cents) allow(PaypalPayoutProcessor).to receive(:topup_amount_in_transit).and_return(topup_in_transit_dollars) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/post_sendgrid_api_spec.rb
Ruby
mit
8,966
main
15,086
# frozen_string_literal: true require "spec_helper" describe PostSendgridApi, :freeze_time do include Rails.application.routes.url_helpers before do @seller = create(:named_user) @post = create(:audience_installment, name: "post title", message: "post body", seller: @seller) described_class.mails.cle...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/firs_tin_validation_service_spec.rb
Ruby
mit
8,966
main
845
# frozen_string_literal: true require "spec_helper" describe FirsTinValidationService do it "returns true when valid FIRS TIN is provided" do firs_tin = "12345678-1234" expect(described_class.new(firs_tin).process).to be(true) end it "returns false when nil FIRS TIN is provided" do expect(described...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/recommended_products_service_spec.rb
Ruby
mit
8,966
main
2,856
# frozen_string_literal: true require "spec_helper" describe RecommendedProductsService do describe ".fetch" do let(:seller) { create(:user) } let!(:sample_product) { create(:product, user: seller) } let!(:product1) { create(:product, name: "Product 1", user: seller) } let!(:product2) { create(:prod...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/cleanup_rpush_device_service_spec.rb
Ruby
mit
8,966
main
864
# frozen_string_literal: true require "spec_helper" describe CleanupRpushDeviceService do before do @device_a = create(:device) @device_b = create(:device) @device_c = create(:device) end it "removes device records for the undeliverable token" do apn_feedback = double(device_token: @device_b.to...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/mailer_attachment_or_link_service_spec.rb
Ruby
mit
8,966
main
1,020
# frozen_string_literal: true require "spec_helper" describe MailerAttachmentOrLinkService do describe "#perform" do before do @file = fixture_file_upload("test.png") end it "generates URL with given file when size is greater than 10 MB" do allow(@file).to receive(:size).and_return(MailerAt...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/bundle_search_products_service_spec.rb
Ruby
mit
8,966
main
4,908
# frozen_string_literal: true require "spec_helper" describe BundleSearchProductsService do let(:seller) { create(:named_seller, :eligible_for_service_products) } let(:bundle) { create(:product, :bundle, user: seller, bundle_products: []) } let(:other_seller) { create(:user) } before do index_model_recor...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/web_spec.rb
Ruby
mit
8,966
main
6,909
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Web do before do @user = create(:user, timezone: "UTC") @products = create_list(:product, 2, user: @user) @service = described_class.new( user: @user, dates: (Date.new(2021, 1, 1) .. Date.new(2021, 1, 3)).to_a ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/product_page_views_spec.rb
Ruby
mit
8,966
main
9,442
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::ProductPageViews do let(:user_timezone) { "UTC" } before do @user = create(:user, timezone: user_timezone) @products = create_list(:product, 2, user: @user) @service = described_class.new( user: @user, products...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/date_query_spec.rb
Ruby
mit
8,966
main
1,121
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::DateQuery do describe ".day_range" do it "builds explicit datetime bounds for dates with a midnight DST gap" do result = described_class.day_range( field: :timestamp, start_date: Date.new(2026, 3, 22), e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/sales_spec.rb
Ruby
mit
8,966
main
10,322
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Sales do let(:user_timezone) { "UTC" } before do @user = create(:user, timezone: user_timezone) @products = create_list(:product, 2, user: @user) @service = described_class.new( user: @user, products: @products...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/following_spec.rb
Ruby
mit
8,966
main
7,841
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Following do before do @user = create(:user, timezone: "UTC") @service = described_class.new(@user) end describe "#by_date" do it "returns expected data" do add_event("added", Time.utc(2021, 1, 1)) add_event(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/churn_spec.rb
Ruby
mit
8,966
main
12,131
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Churn do let(:seller) { create(:user, timezone: "UTC", created_at: Time.utc(2020, 1, 1)) } let(:product1) { create(:product, :is_subscription, user: seller, name: "Product Alpha") } let(:product2) { create(:product, :is_subscription,...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/caching_proxy_spec.rb
Ruby
mit
8,966
main
18,788
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::CachingProxy do describe "#data_for_dates" do before do @user = create(:user, timezone: "London", created_at: Time.utc(2019, 1, 1)) travel_to Time.utc(2020, 1, 1) @product = create(:product, user: @user) @date...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/churn/dataset_builder_spec.rb
Ruby
mit
8,966
main
15,254
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Churn::DatasetBuilder do let(:seller) { create(:user, timezone: "UTC", created_at: Time.utc(2020, 1, 1)) } let(:product1) { create(:product, :is_subscription, user: seller, name: "Product Alpha") } let(:product2) { create(:product, :...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/churn/elasticsearch_fetcher_spec.rb
Ruby
mit
8,966
main
11,676
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Churn::ElasticsearchFetcher do let(:seller) { create(:user, timezone: "UTC", created_at: Time.utc(2020, 1, 1)) } let(:product1) { create(:product, :is_subscription, user: seller) } let(:product2) { create(:product, :is_subscription, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/churn/product_scope_spec.rb
Ruby
mit
8,966
main
5,270
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Churn::ProductScope do let(:seller) { create(:user, timezone: "UTC") } let(:service) { described_class.new(seller:) } def create_product_with_purchase(created_at: nil, **product_options) product = create(:product, user: seller, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/churn/date_window_spec.rb
Ruby
mit
8,966
main
8,964
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::Churn::DateWindow do let(:seller) { create(:user, timezone: "UTC", created_at: Time.utc(2020, 1, 1)) } let(:product_scope) { CreatorAnalytics::Churn::ProductScope.new(seller:) } def create_product_with_purchase(created_at: nil, **pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/caching_proxy/formatters/by_referral_spec.rb
Ruby
mit
8,966
main
9,110
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::CachingProxy::Formatters::ByReferral do before do @user = create(:user) @dates = (Date.new(2021, 1, 1) .. Date.new(2021, 1, 5)).to_a create(:purchase, link: create(:product, user: @user), created_at: Date.new(2020, 8, 15)) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/caching_proxy/formatters/by_state_spec.rb
Ruby
mit
8,966
main
1,794
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::CachingProxy::Formatters::ByState do before do @service = CreatorAnalytics::CachingProxy.new(build(:user)) end describe "#merge_data_by_state" do it "returns data merged by state" do day_one = { by_state: { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/creator_analytics/caching_proxy/formatters/by_date_spec.rb
Ruby
mit
8,966
main
5,099
# frozen_string_literal: true require "spec_helper" describe CreatorAnalytics::CachingProxy::Formatters::ByDate do before do @service = CreatorAnalytics::CachingProxy.new(build(:user)) end describe "#merge_data_by_date" do it "returns data merged by date" do day_one = { dates_and_months: ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/charge/create_service_spec.rb
Ruby
mit
8,966
main
10,922
# frozen_string_literal: false describe Charge::CreateService, :vcr do let(:seller_1) { create(:user) } let(:seller_2) { create(:user) } let(:price_1) { 5_00 } let(:price_2) { 10_00 } let(:price_3) { 10_00 } let(:price_4) { 10_00 } let(:price_5) { 10_00 } let(:product_1) { create(:product, user: seller...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/follower/create_service_spec.rb
Ruby
mit
8,966
main
7,104
# frozen_string_literal: false describe Follower::CreateService do let(:user) { create(:user) } let(:follower_user) { create(:user) } let(:follower) { create(:follower, user:) } let(:active_follower) { create(:active_follower, user:) } let(:deleted_follower) { create(:deleted_follower, user:) } context "w...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/recommended_products/checkout_service_spec.rb
Ruby
mit
8,966
main
13,434
# frozen_string_literal: true require "spec_helper" describe RecommendedProducts::CheckoutService do let(:recommender_model_name) { RecommendedProductsService::MODEL_SALES } let(:products) { create_list(:product, 5) } let(:seller1) { create(:user) } let(:product1) { create(:product, user: seller1) } let(:s...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/recommended_products/discover_service_spec.rb
Ruby
mit
8,966
main
4,006
# frozen_string_literal: true require "spec_helper" describe RecommendedProducts::DiscoverService do let(:purchaser) { create(:user) } let(:products) { create_list(:product, 5) } let(:products_relation) { Link.where(id: products.map(&:id)) } let(:recommender_model_name) { RecommendedProductsService::MODEL_SAL...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product_review/update_service_spec.rb
Ruby
mit
8,966
main
2,796
# frozen_string_literal: true require "spec_helper" RSpec.describe ProductReview::UpdateService do let(:purchaser) { create(:user) } let(:purchase) { create(:purchase, purchaser:) } let(:product_review) do create(:product_review, purchase:, rating: 3, message: "Original message") end describe "#update"...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/collaborator/create_service_spec.rb
Ruby
mit
8,966
main
9,477
# frozen_string_literal: true require "spec_helper" describe Collaborator::CreateService do describe "#process" do let(:seller) { create(:user) } let(:collaborating_user) { create(:user) } let(:products) { create_list(:product, 3, user: seller) } let!(:enabled_products) { products.first(2) } let...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/collaborator/update_service_spec.rb
Ruby
mit
8,966
main
3,531
# frozen_string_literal: true require "spec_helper" describe Collaborator::UpdateService do describe "#process" do let(:seller) { create(:user) } let(:product1) { create(:product, user: seller) } let(:product2) { create(:product, user: seller) } let(:product3) { create(:product, user: seller) } ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/bundle/update_products_service_spec.rb
Ruby
mit
8,966
main
2,556
# frozen_string_literal: true require "spec_helper" describe Bundle::UpdateProductsService do describe "#perform" do let(:seller) { create(:named_seller, :eligible_for_service_products) } let(:bundle) { create(:product, user: seller, price_cents: 2000, is_bundle: true, native_type: Link::NATIVE_TYPE_BUNDLE)...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/content_moderation/content_extractor_spec.rb
Ruby
mit
8,966
main
6,811
# frozen_string_literal: true require "spec_helper" RSpec.describe ContentModeration::ContentExtractor do describe "#extract_from_product" do let(:extractor) { described_class.new } let(:product) do create( :product, name: "Moderated Product", description: '<p>Main description<...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/content_moderation/moderate_record_service_spec.rb
Ruby
mit
8,966
main
6,000
# frozen_string_literal: true require "spec_helper" RSpec.describe ContentModeration::ModerateRecordService, :vcr do let(:strategy_result) { Struct.new(:status, :reasoning, keyword_init: true) } let(:seller) { create(:user) } let(:product) { create(:product, user: seller, name: "Test", description: "Clean descr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/content_moderation/strategies/classifier_strategy_spec.rb
Ruby
mit
8,966
main
13,370
# frozen_string_literal: true require "spec_helper" RSpec.describe ContentModeration::Strategies::ClassifierStrategy, :vcr do let(:text) { "text to moderate" } let(:image_urls) { ["https://cdn.example.com/1.png"] } let(:client) { instance_double(OpenAI::Client) } before do allow(GlobalConfig).to receive(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/content_moderation/strategies/prompt_strategy_spec.rb
Ruby
mit
8,966
main
9,704
# frozen_string_literal: true require "spec_helper" RSpec.describe ContentModeration::Strategies::PromptStrategy, :vcr do let(:client) { instance_double(OpenAI::Client) } before do allow(GlobalConfig).to receive(:get).and_call_original allow(GlobalConfig).to receive(:get).with("OPENAI_ACCESS_TOKEN").and_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/content_moderation/strategies/blocklist_strategy_spec.rb
Ruby
mit
8,966
main
3,492
# frozen_string_literal: true require "spec_helper" RSpec.describe ContentModeration::Strategies::BlocklistStrategy, :vcr do before do allow(GlobalConfig).to receive(:get).and_call_original allow(File).to receive(:exist?).and_call_original allow(File).to receive(:exist?).with(described_class::YAML_PATH)...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/onetime/backfill_license_uses_for_seller_spec.rb
Ruby
mit
8,966
main
2,237
# frozen_string_literal: true require "spec_helper" describe Onetime::BackfillLicenseUsesForSeller do describe "#process" do let(:seller) { create(:user) } let(:product) { create(:product, user: seller) } def create_purchase_with_license(seller:, product:, purchase_state: "successful") purchase =...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/helper/client_spec.rb
Ruby
mit
8,966
main
5,249
# frozen_string_literal: true require "spec_helper" describe Helper::Client do let(:helper) { Helper::Client.new } let(:conversation_id) { "123456" } let(:timestamp) { DateTime.current.to_i } describe "#create_hmac_digest" do let(:secret_key) { "secret_key" } before do allow(GlobalConfig).to r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/helper/unblock_email_service_spec.rb
Ruby
mit
8,966
main
9,614
# frozen_string_literal: true require "spec_helper" describe Helper::UnblockEmailService do include ActionView::Helpers::TextHelper describe "#process" do let(:conversation_id) { "123" } let(:email_id) { "456" } let(:email) { "sam@example.com" } let(:unblock_email_service) { described_class.new(c...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/create_service_spec.rb
Ruby
mit
8,966
main
139,084
# frozen_string_literal: false include CurrencyHelper describe Purchase::CreateService, :vcr do let(:user) { create(:user) } let(:email) { "sahil@gumroad.com" } let(:buyer) { create(:user, email:) } let(:zip_code) { "12345" } let(:price) { 600 } let(:max_purchase_count) { nil } let(:product) { create(:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/associate_bundle_product_level_gift_service_spec.rb
Ruby
mit
8,966
main
5,302
# frozen_string_literal: false describe Purchase::AssociateBundleProductLevelGiftService do describe "#perform" do let(:seller) { create(:named_seller) } let(:gifter_email) { "gifter@example.com" } let(:giftee_email) { "giftee@example.com" } let(:bundle) { create(:product, :bundle, user: seller) } ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/variant_updater_service_spec.rb
Ruby
mit
8,966
main
9,829
# frozen_string_literal: true require "spec_helper" describe Purchase::VariantUpdaterService do describe ".perform" do context "when the product has variants" do before :each do @product = create(:product) @category1 = create(:variant_category, link: @product, title: "Color") categ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/mark_successful_service_spec.rb
Ruby
mit
8,966
main
430
# frozen_string_literal: false describe Purchase::MarkSuccessfulService do describe "#handle_purchase_success" do it "calls save_gumroad_day_timezone on seller if purchase is neither free nor a test purchase" do expect_any_instance_of(User).to receive(:save_gumroad_day_timezone).and_call_original Pu...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/update_bundle_purchase_content_service_spec.rb
Ruby
mit
8,966
main
1,452
# frozen_string_literal: false describe Purchase::UpdateBundlePurchaseContentService do describe "#perform" do let(:seller) { create(:named_seller) } let(:purchaser) { create(:buyer_user) } let(:bundle) { create(:product, user: seller, is_bundle: true) } let(:product) { create(:product, user: seller...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/confirm_service_spec.rb
Ruby
mit
8,966
main
13,723
# frozen_string_literal: false describe Purchase::ConfirmService, :vcr do include ManageSubscriptionHelpers let(:user) { create(:user) } let(:chargeable) { build(:chargeable, card: StripePaymentMethodHelper.success_sca_not_required) } context "when purchase has been marked as failed" do # Sometimes we ma...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/sync_status_with_charge_processor_service_spec.rb
Ruby
mit
8,966
main
17,336
# frozen_string_literal: false describe Purchase::SyncStatusWithChargeProcessorService, :vcr do before do MerchantAccount.find_or_create_by!(user_id: nil, charge_processor_id: StripeChargeProcessor.charge_processor_id) do |ma| ma.charge_processor_alive_at = Time.current end @initial_balance = 200 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/purchase/create_bundle_product_purchase_service_spec.rb
Ruby
mit
8,966
main
5,495
# frozen_string_literal: false describe Purchase::CreateBundleProductPurchaseService do describe "#perform" do let(:seller) { create(:named_seller) } let(:purchaser) { create(:buyer_user) } let(:bundle) { create(:product, user: seller, is_bundle: true) } let(:versioned_product) { create(:product_wit...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/integrations/discord_integration_service_spec.rb
Ruby
mit
8,966
main
25,356
# frozen_string_literal: true require "spec_helper" describe Integrations::DiscordIntegrationService do let(:integration) { create(:discord_integration) } let(:server_id) { integration.server_id } let(:user_id) { "694641779777077339" } let(:regular_user_role_id) { "111111111111111111" } let(:gumroad_bot_rol...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/integrations/circle_integration_service_spec.rb
Ruby
mit
8,966
main
10,690
# frozen_string_literal: true require "spec_helper" describe Integrations::CircleIntegrationService, :without_circle_rate_limit do let(:community_id) { 3512 } let(:space_group_id) { 43576 } let(:email) { "test_circle_integration@gumroad.com" } before do @user = create(:user, email:) @integration = cr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/integrations/base_integration_service_spec.rb
Ruby
mit
8,966
main
356
# frozen_string_literal: true require "spec_helper" describe Integrations::BaseIntegrationService do it "raises runtime error on direct instantiation" do expect { Integrations::BaseIntegrationService.new }.to raise_error(RuntimeError, "Integrations::BaseIntegrationService should not be instantiated. Instantiate...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/handle_email_event_info/for_abandoned_cart_email_spec.rb
Ruby
mit
8,966
main
18,329
# frozen_string_literal: true describe HandleEmailEventInfo::ForAbandonedCartEmail do let!(:abandoned_cart_workflow1) { create(:abandoned_cart_workflow) } let(:abandoned_cart_workflow_installment1) { abandoned_cart_workflow1.alive_installments.sole } let!(:abandoned_cart_workflow2) { create(:abandoned_cart_workf...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/handle_email_event_info/for_installment_email_spec.rb
Ruby
mit
8,966
main
29,002
# frozen_string_literal: true describe HandleEmailEventInfo::ForInstallmentEmail do before do @installment = create(:installment) @purchase = create(:purchase) @identifier = "[#{@purchase.id}, #{@installment.id}]" end describe ".perform" do it "creates a new CreatorEmailOpenEvent object" do ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/handle_email_event_info/for_receipt_email_spec.rb
Ruby
mit
8,966
main
17,200
# frozen_string_literal: true describe HandleEmailEventInfo::ForReceiptEmail do let!(:preorder) { create(:preorder) } let(:purchase) { create(:purchase) } def handler_class_for(email_provider) case email_provider when :sendgrid then HandleSendgridEventJob when :resend then HandleResendEventJob e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/pdf_stamping_service/stamp_for_purchase_spec.rb
Ruby
mit
8,966
main
2,929
# frozen_string_literal: true require "spec_helper" describe PdfStampingService::StampForPurchase do describe ".perform!" do let(:product) { create(:product) } let(:purchase) { create(:purchase, link: product) } before do purchase.create_url_redirect! end context "with stampable PDFs" do...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/pdf_stamping_service/stamp_spec.rb
Ruby
mit
8,966
main
4,705
# frozen_string_literal: true require "spec_helper" describe PdfStampingService::Stamp do describe ".can_stamp_file?" do context "with readable PDF" do let(:pdf) { create(:readable_document, url: "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/specs/billion-dollar-company-chapter-0.pdf") } it "returns true" do ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/push_notification_service/ios_spec.rb
Ruby
mit
8,966
main
4,575
# frozen_string_literal: true require "spec_helper" describe PushNotificationService::Ios do describe "creator app" do it "creates an APNS notification" do app = double("apns_app") allow(PushNotificationService::Ios).to receive(:creator_app).and_return(app) device_token = "ABC" title = ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/push_notification_service/android_spec.rb
Ruby
mit
8,966
main
2,595
# frozen_string_literal: true require "spec_helper" describe PushNotificationService::Android do before do Feature.activate(:send_notifications_to_android_devices) end describe "consumer app" do context "when notification sound is passed" do it "creates a FCM notification with sound" do a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product/compute_call_availabilities_service_spec.rb
Ruby
mit
8,966
main
5,452
# frozen_string_literal: true require "spec_helper" describe Product::ComputeCallAvailabilitiesService, :freeze_time do let(:seller) { create(:user, :eligible_for_service_products) } let(:call_product) { create(:call_product, user: seller) } let(:call_limitation_info) { call_product.call_limitation_info } le...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product/save_cancellation_discount_service_spec.rb
Ruby
mit
8,966
main
4,261
# frozen_string_literal: true RSpec.describe Product::SaveCancellationDiscountService do let(:product) { create(:membership_product_with_preset_tiered_pricing) } let(:service) { described_class.new(product, cancellation_discount_params) } describe "#perform" do context "with fixed amount discount" do ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product/bulk_update_support_email_service_spec.rb
Ruby
mit
8,966
main
4,062
# frozen_string_literal: true require "spec_helper" describe Product::BulkUpdateSupportEmailService do let(:user) { create(:user) } let!(:product1) { create(:product, user:, support_email: "old1@example.com") } let!(:product2) { create(:product, user:, support_email: "old2@example.com") } let!(:product3) { c...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product/save_post_purchase_custom_fields_service_spec.rb
Ruby
mit
8,966
main
9,500
# frozen_string_literal: true require "spec_helper" describe Product::SavePostPurchaseCustomFieldsService do describe "#perform" do let(:product) { create(:product_with_digital_versions, has_same_rich_content_for_all_variants: true) } let!(:long_answer) { create(:custom_field, seller: product.user, product...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/services/product/skus_updater_service_spec.rb
Ruby
mit
8,966
main
5,955
# frozen_string_literal: true require "spec_helper" describe Product::SkusUpdaterService do describe ".perform" do before do @product = create(:physical_product, skus_enabled: true) @category1 = create(:variant_category, title: "Size", link: @product) @variant1 = create(:variant, variant_categ...