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/models/jordan_bank_account_spec.rb
Ruby
mit
8,966
main
900
# frozen_string_literal: true describe JordanBankAccount do describe "#bank_account_type" do it "returns JO" do expect(create(:jordan_bank_account).bank_account_type).to eq("JO") end end describe "#country" do it "returns JO" do expect(create(:jordan_bank_account).country).to eq("JO") ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/tag_spec.rb
Ruby
mit
8,966
main
4,561
# frozen_string_literal: true require "spec_helper" describe Tag do before { @product = create(:product) } it "Creates a new tag by name" do expect(@product.has_tag?("bAdger")).to be(false) expect { @product.tag!("Badger") }.to change { @product.tags.count }.by(1) expect(@product.tags.last.name).to e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/uae_bank_account_spec.rb
Ruby
mit
8,966
main
2,143
# frozen_string_literal: true require "spec_helper" describe UaeBankAccount do describe "#bank_account_type" do it "returns AE" do expect(create(:uae_bank_account).bank_account_type).to eq("AE") end end describe "#country" do it "returns AE" do expect(create(:uae_bank_account).country)....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/product_page_view_spec.rb
Ruby
mit
8,966
main
637
# frozen_string_literal: true require "spec_helper" describe ProductPageView do it "can have documents added to its index" do document_id = SecureRandom.uuid EsClient.index( index: described_class.index_name, id: document_id, body: { "product_id" => 123, "seller_id" => 456,...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/upsell_purchase_spec.rb
Ruby
mit
8,966
main
4,675
# frozen_string_literal: true require "spec_helper" describe UpsellPurchase do describe "validations" do context "when the upsell doesn't belong to the purchase's product" do let(:upsell_purchase) { build(:upsell_purchase, selected_product: create(:product), purchase: create(:purchase, link: create(:produ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/collaborator_invitation_spec.rb
Ruby
mit
8,966
main
1,649
# frozen_string_literal: true require "spec_helper" RSpec.describe CollaboratorInvitation, type: :model do describe "#accept!" do it "destroys the invitation" do invitation = create(:collaborator_invitation) expect { invitation.accept! }.to change(CollaboratorInvitation, :count).by(-1) expect...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/sweden_bank_account_spec.rb
Ruby
mit
8,966
main
2,183
# frozen_string_literal: true require "spec_helper" describe SwedenBankAccount do describe "#bank_account_type" do it "returns sweden" do expect(create(:sweden_bank_account).bank_account_type).to eq("SE") end end describe "#country" do it "returns SE" do expect(create(:sweden_bank_accou...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/turkey_bank_account_spec.rb
Ruby
mit
8,966
main
2,639
# frozen_string_literal: true require "spec_helper" describe TurkeyBankAccount do describe "#bank_account_type" do it "returns Turkey" do expect(create(:turkey_bank_account).bank_account_type).to eq("TR") end end describe "#country" do it "returns TR" do expect(create(:turkey_bank_accou...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/romania_bank_account_spec.rb
Ruby
mit
8,966
main
2,196
# frozen_string_literal: true require "spec_helper" describe RomaniaBankAccount do describe "#bank_account_type" do it "returns romania" do expect(create(:romania_bank_account).bank_account_type).to eq("RO") end end describe "#country" do it "returns RO" do expect(create(:romania_bank_a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/preorder_spec.rb
Ruby
mit
8,966
main
42,547
# frozen_string_literal: true require "spec_helper" describe Preorder, :vcr do before do $currency_namespace = Redis::Namespace.new(:currencies, redis: $redis) end describe "mobile_json_data" do it "returns proper json for a preorder without a url redirect" do good_card = build(:chargeable) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/egypt_bank_account_spec.rb
Ruby
mit
8,966
main
1,327
# frozen_string_literal: true require "spec_helper" describe KenyaBankAccount do describe "#bank_account_type" do it "returns EG" do expect(create(:egypt_bank_account).bank_account_type).to eq("EG") end end describe "#country" do it "returns EG" do expect(create(:egypt_bank_account).cou...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/taxonomy_spec.rb
Ruby
mit
8,966
main
1,810
# frozen_string_literal: true require "spec_helper" describe Taxonomy do describe "validations" do describe "slug presence validation" do context "when slug is present" do subject { build(:taxonomy, slug: "example") } it { is_expected.to be_valid } end context "when slug is n...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_balances_spec.rb
Ruby
mit
8,966
main
40,485
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_refunds_spec.rb
Ruby
mit
8,966
main
101,078
# 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 }...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_zip_spec.rb
Ruby
mit
8,966
main
6,606
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_installments_spec.rb
Ruby
mit
8,966
main
45,168
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_taxation_spec.rb
Ruby
mit
8,966
main
23,247
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_process_spec.rb
Ruby
mit
8,966
main
45,369
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_sales_tax_spec.rb
Ruby
mit
8,966
main
20,395
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/inventory_counter_cache_spec.rb
Ruby
mit
8,966
main
12,996
# frozen_string_literal: true require "spec_helper" describe "Purchase inventory counter cache" do let(:product) { create(:product) } let(:variant_category) { create(:variant_category, link: product) } let(:variant) { create(:variant, variant_category:) } describe "#counts_towards_inventory?" do it "retu...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_notification_spec.rb
Ruby
mit
8,966
main
7,727
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_gifts_spec.rb
Ruby
mit
8,966
main
5,133
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/purchase/purchase_subscription_spec.rb
Ruby
mit
8,966
main
20,761
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/mailer_info/router_spec.rb
Ruby
mit
8,966
main
4,523
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/mailer_info/delivery_method_spec.rb
Ruby
mit
8,966
main
3,213
# 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,...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/mailer_info/header_builder_spec.rb
Ruby
mit
8,966
main
6,621
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/mailer_info/encryption_spec.rb
Ruby
mit
8,966
main
1,935
# 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"...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/with_filtering_spec.rb
Ruby
mit
8,966
main
27,700
# frozen_string_literal: true require "spec_helper" describe WithFiltering do describe "scopes" do describe "abandoned_cart_type" do it "returns only installments with the 'abandoned_cart' type" do abandoned_cart_installment = create(:installment, installment_type: Installment::ABANDONED_CART_TYPE...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/two_factor_authentication_spec.rb
Ruby
mit
8,966
main
5,369
# frozen_string_literal: true require "spec_helper" describe TwoFactorAuthentication do before do @user = create(:user) end describe "#otp_secret_key" do it "sets otp_secret_key for a new user" do expect(@user.otp_secret_key.length).to eq 32 end end describe ".find_by_encrypted_external_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/json_data_spec.rb
Ruby
mit
8,966
main
2,508
# frozen_string_literal: true require "spec_helper" describe JsonData do # This can be any model, but I'm using the Purchase model for the tests. I could not # find a way to create a mock model which included JsonData. let(:model) do create(:purchase) end describe "attr_json_data_accessor" do descr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/unused_columns_spec.rb
Ruby
mit
8,966
main
975
# frozen_string_literal: true require "spec_helper" ActiveRecord::Schema.define do create_table :test_models, temporary: true, force: true do |t| t.string :name t.string :email t.string :description end end describe UnusedColumns do class TestModel < ActiveRecord::Base include UnusedColumns ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/search_index_model_common_spec.rb
Ruby
mit
8,966
main
1,686
# frozen_string_literal: true describe SearchIndexModelCommon do before do @klass = Class.new(User) @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1 include SearchIndexModelCommon include Elasticsearch::Model index_name "user-fake-index-for-test" mappings do indexes :first_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/attribute_blockable_spec.rb
Ruby
mit
8,966
main
32,174
# frozen_string_literal: true require "spec_helper" describe AttributeBlockable do let(:blocked_email) { "blocked@example.com" } let(:unblocked_email) { "unblocked@example.com" } let(:user_with_blocked_email) { create(:user, email: blocked_email) } let(:user_with_unblocked_email) { create(:user, email: unbloc...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/timestamp_state_fields_spec.rb
Ruby
mit
8,966
main
1,548
# frozen_string_literal: true require "spec_helper" describe TimestampStateFields do class TestUser < ApplicationRecord self.table_name = "users" include TimestampStateFields timestamp_state_fields \ :created, :confirmed, :banned, :deleted, default_state: :confirmed, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/stripped_fields_spec.rb
Ruby
mit
8,966
main
1,061
# frozen_string_literal: true require "spec_helper" ActiveRecord::Schema.define do create_table :test_fields, temporary: true, force: true do |t| t.string :name t.string :email t.string :description t.string :sql t.string :code end end describe StrippedFields do class TestField < Applicatio...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/transactional_attribute_change_tracker_spec.rb
Ruby
mit
8,966
main
2,565
# frozen_string_literal: true describe TransactionalAttributeChangeTracker do before do @model = create_mock_model @model.include(described_class) end after do destroy_mock_model(@model) end describe "#attributes_committed" do let!(:record) { @model.create! } let(:fresh_record) { @model...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/rich_contents_spec.rb
Ruby
mit
8,966
main
7,082
# frozen_string_literal: true require "spec_helper" describe RichContents do let(:description) { [{ "type" => "paragraph", "content" => [{ "text" => Faker::Lorem.unique.sentence, "type" => "text" }] }] } context "for a product" do let(:product) { create(:product) } describe "#rich_content_json" do ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/charge_processable_spec.rb
Ruby
mit
8,966
main
2,505
# frozen_string_literal: true require "spec_helper" RSpec.describe ChargeProcessable do let(:test_class) do Class.new do include ChargeProcessable attr_accessor :charge_processor_id def initialize(charge_processor_id) @charge_processor_id = charge_processor_id end end end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/secure_external_id_spec.rb
Ruby
mit
8,966
main
10,492
# frozen_string_literal: true require "spec_helper" RSpec.describe SecureExternalId do let(:test_class) do Class.new do include SecureExternalId def self.name "TestClass" end def self.find_by(conditions) new if conditions[:id] == 123 end def id 123 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/charge/chargeable_spec.rb
Ruby
mit
8,966
main
17,874
# frozen_string_literal: true require "spec_helper" describe Charge::Chargeable do describe ".find_by_stripe_event" do describe "for an event on a Purchase" do it "finds the purchase using charge reference that is purchase's external id" do purchase = create(:purchase, id: 12345) event = b...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/charge/disputable_spec.rb
Ruby
mit
8,966
main
60,340
# frozen_string_literal: true require "spec_helper" describe Charge::Disputable, :vcr do let(:stripe_purchase) do create(:purchase, charge_processor_id: StripeChargeProcessor.charge_processor_id, stripe_transaction_id: "ch_12345", total_transaction_cents: 10_00, succe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/workflow/abandoned_cart_products_spec.rb
Ruby
mit
8,966
main
9,905
# frozen_string_literal: true require "spec_helper" describe Workflow::AbandonedCartProducts do include Rails.application.routes.url_helpers describe "#abandoned_cart_products" do let(:seller) { create(:user) } let!(:product1) { create(:product, user: seller, name: "Product 1") } let!(:product2) { cr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/affiliate/sorting_spec.rb
Ruby
mit
8,966
main
5,664
# frozen_string_literal: true require "spec_helper" describe Affiliate::Sorting do describe ".sorted_by" do let!(:seller) { create(:named_seller) } let!(:product1) { create(:product, user: seller, name: "p1") } let!(:product2) { create(:product, user: seller, name: "p2") } let!(:product3) { create(:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/affiliate/cookies_spec.rb
Ruby
mit
8,966
main
8,054
# frozen_string_literal: true require "spec_helper" describe Affiliate::Cookies do let(:affiliate) { create(:direct_affiliate) } let(:another_affiliate) { create(:direct_affiliate) } describe "instance methods" do describe "#cookie_key" do it "generates cookie key with proper prefix and encrypted ID"...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/product/as_json_spec.rb
Ruby
mit
8,966
main
23,607
# frozen_string_literal: true require "spec_helper" describe Product::AsJson, :vcr do describe "as_json method" do before do @product = create(:product, name: "some link", require_shipping: true) end it "returns the correct has for default (public)" do expect(@product.as_json.key?("name"))....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/product/sorting_spec.rb
Ruby
mit
8,966
main
10,455
# frozen_string_literal: true require "spec_helper" describe Product::Sorting do let!(:seller) { create(:recommendable_user) } describe ".sorted_by" do let!(:collaborator) { create(:collaborator, seller:) } let!(:product1) { create(:product, :is_collab, collaborator:, user: seller, name: "p1", display_pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/product/structured_data_spec.rb
Ruby
mit
8,966
main
15,002
# frozen_string_literal: true require "spec_helper" describe Product::StructuredData do let(:user) { create(:user, name: "John Doe") } let(:product) { create(:product, user:, name: "My Great Book") } describe "#structured_data" do context "when product is not an ebook" do before do product.up...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/product/staff_picked_spec.rb
Ruby
mit
8,966
main
1,772
# frozen_string_literal: true require "spec_helper" describe Product::StaffPicked do let(:product) { create(:product) } describe "#staff_picked?" do context "when there is no staff_picked_product record" do it "returns false" do expect(product.staff_picked?).to eq(false) end end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/installment/searchable_spec.rb
Ruby
mit
8,966
main
914
# frozen_string_literal: true require "spec_helper" describe Installment::Searchable do describe "#as_indexed_json" do let(:installment) { create(:published_installment, name: "First post", message: "<p>body</p>") } it "includes all fields" do expect(installment.as_indexed_json).to eq( "messa...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/mailer_level_spec.rb
Ruby
mit
8,966
main
1,808
# frozen_string_literal: true require "spec_helper" describe User::MailerLevel do describe "#mailer_level" do before do @creator = create(:user) end context "when creator belongs to level_1" do it "returns :level_1" do expect(@creator.mailer_level).to eq :level_1 end it...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/followers_spec.rb
Ruby
mit
8,966
main
3,674
# frozen_string_literal: true require "spec_helper" describe User::Followers do describe "#following" do let(:following_user) { create(:user, email: "follower@example.com") } let(:not_following_user) { create(:user) } let(:creator_one) { create(:user) } let(:creator_two) { create(:user) } let!(:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/money_balance_spec.rb
Ruby
mit
8,966
main
2,757
# frozen_string_literal: true require "spec_helper" describe User::MoneyBalance, :vcr do describe "balance_formatted" do before do @user = create(:user, unpaid_balance_cents: 1_00) end it "returns the user's balance" do expect(@user.unpaid_balance_cents).to eq 100 expect(@user.balance...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/affiliated_products_spec.rb
Ruby
mit
8,966
main
4,591
# frozen_string_literal: true require "spec_helper" describe User::AffiliatedProducts, :vcr do describe "#directly_affiliated_products" do let(:affiliate_user) { create(:affiliate_user) } let(:creator_one) { create(:named_user) } let(:creator_two) { create(:named_user) } let!(:product_one) { create(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/purchases_spec.rb
Ruby
mit
8,966
main
791
# frozen_string_literal: true require "spec_helper" describe User::Purchases do describe "#transfer_purchases!" do let(:user) { create(:user) } let(:new_user) { create(:user) } let!(:purchases) { create_list(:purchase, 3, email: user.email, purchaser: user) } it "transfers purchases to the new user...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/social_apple_spec.rb
Ruby
mit
8,966
main
3,491
# frozen_string_literal: true require "spec_helper" describe User::SocialApple do let(:user) { create(:user) } describe ".find_or_create_for_apple_oauth" do let(:apple_uid) { "001234.abcdef1234567890abcdef1234567890.1234" } let(:apple_data) do { "uid" => apple_uid, "info" => { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/stripe_connect_spec.rb
Ruby
mit
8,966
main
3,559
# frozen_string_literal: true require "spec_helper" describe User::StripeConnect do describe ".find_or_create_for_stripe_connect_account" do before do @data = { "provider" => "stripe_connect", "uid" => "acct_1MbJuNSAp3rt4s0F", "info" => { "name" => "Gum Bot", "e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/as_json_spec.rb
Ruby
mit
8,966
main
3,750
# frozen_string_literal: true require "spec_helper" describe User::AsJson do describe "#as_json" do let(:user) { create(:named_user, *user_traits) } let(:user_traits) { [] } let(:options) { {} } subject(:as_json) { user.as_json(options) } before do create(:product, user:, custom_permalin...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/taxation_spec.rb
Ruby
mit
8,966
main
11,945
# frozen_string_literal: true require "spec_helper" describe User::Taxation do include PaymentsHelper before do @user = create(:user) end describe "#eligible_for_1099_k?", :vcr do let(:year) { Date.current.year } before do create(:merchant_account_stripe, user: @user) create(:tos_ag...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/email_normalization_spec.rb
Ruby
mit
8,966
main
3,770
# frozen_string_literal: true require "spec_helper" describe User::EmailNormalization do describe ".normalize_gmail_address" do it "strips plus-addressing from Gmail addresses" do expect(User.normalize_gmail_address("user+suffix@gmail.com")).to eq("user@gmail.com") end it "removes dots from Gmail...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/payout_info_spec.rb
Ruby
mit
8,966
main
5,897
# frozen_string_literal: true require "spec_helper" describe User::PayoutInfo do let(:user) { create(:user, payment_address: "test@example.com", payouts_paused_internally: true) } let(:manual_payout_end_date) { Date.today } before do allow(User::PayoutSchedule).to receive(:manual_payout_end_date).and_retur...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/low_balance_fraud_check_spec.rb
Ruby
mit
8,966
main
7,767
# frozen_string_literal: true require "spec_helper" describe User::LowBalanceFraudCheck do before do @creator = create(:user) @purchase = create(:refunded_purchase, link: create(:product, user: @creator)) end describe "#enable_refunds!" do before do @creator.refunds_disabled = true end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/team_spec.rb
Ruby
mit
8,966
main
5,746
# frozen_string_literal: true require "spec_helper" describe User::Team do let(:user) { create(:user) } let(:other_seller) { create(:user) } describe "#member_of?" do context "with self as seller" do it "returns true" do expect(user.member_of?(user)).to be(true) end end context...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/user/vip_creator_spec.rb
Ruby
mit
8,966
main
1,022
# frozen_string_literal: true require "spec_helper" describe User::VipCreator do let(:user) { create(:user) } describe "#vip_creator?" do context "when gross completed payouts exceed the threshold" do it "returns true" do create(:payment_completed, user:, amount_cents: 3_000_00) create(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/order/orderable_spec.rb
Ruby
mit
8,966
main
4,960
# frozen_string_literal: true require "spec_helper" describe Order::Orderable do describe "For Purchase" do let(:purchase) { create(:purchase) } describe "#require_shipping?" do context "when the product is not physical" do it "returns false" do expect(purchase.require_shipping?).to...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/video_file/has_thumbnail_spec.rb
Ruby
mit
8,966
main
2,689
# frozen_string_literal: true require "spec_helper" RSpec.describe VideoFile::HasThumbnail do subject(:video_file) { build(:video_file) } let(:jpg_image) { fixture_file_upload("test.jpg") } let(:png_image) { fixture_file_upload("test.png") } let(:gif_image) { fixture_file_upload("test.gif") } describe "va...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/upsell/sorting_spec.rb
Ruby
mit
8,966
main
2,323
# frozen_string_literal: true require "spec_helper" describe Upsell::Sorting do describe ".sorted_by" do let(:seller) { create(:named_seller) } let(:product1) { create(:product_with_digital_versions, user: seller, price_cents: 2000, name: "Product 1") } let(:product2) { create(:product_with_digital_vers...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/payment/failure_reason_spec.rb
Ruby
mit
8,966
main
2,434
# frozen_string_literal: true require "spec_helper" describe Payment::FailureReason do let(:payment) { create(:payment) } describe "#add_payment_failure_reason_comment" do context "when failure_reason is not present" do it "doesn't add payout note to the user" do expect do payment.mar...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/receipt_spec.rb
Ruby
mit
8,966
main
3,686
# frozen_string_literal: true require "spec_helper" describe Purchase::Receipt do let(:purchase) { create(:purchase) } describe "#receipt_email_info" do let(:charge) { create(:charge, purchases: [purchase]) } let(:order) { charge.order } context "without email info records" do it "returns nil"...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/paypal_spec.rb
Ruby
mit
8,966
main
1,016
# frozen_string_literal: true require "spec_helper" describe Purchase::Paypal do let(:charge_processor_id) { nil } let(:card_visual) { "user@example.com" } let(:purchase) { build(:purchase, charge_processor_id:, card_visual:) } describe "#paypal_email" do context "when charge_processor_id is PayPal" do ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/blockable_spec.rb
Ruby
mit
8,966
main
43,235
# frozen_string_literal: true require "spec_helper" describe Purchase::Blockable do let(:product) { create(:product) } let(:buyer) { create(:user) } let(:purchase) { create(:purchase, link: product, email: "gumbot@gumroad.com", purchaser: buyer) } describe "#buyer_blocked?" do it "returns false when buye...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/reportable_spec.rb
Ruby
mit
8,966
main
1,446
# frozen_string_literal: true require "spec_helper" describe Purchase::Reportable do let(:product) { create(:product) } let(:purchase) { create(:purchase, link: product) } describe "#price_cents_net_of_refunds" do it "returns the price" do expect(purchase.price_cents_net_of_refunds).to eq(100) en...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/charge_events_handler_spec.rb
Ruby
mit
8,966
main
14,952
# frozen_string_literal: true require "spec_helper" describe Purchase::ChargeEventsHandler, :vcr do include CurrencyHelper include ProductsHelper describe "charge event looked up by external ID" do let(:purchase) { create(:purchase, price_cents: 100, total_transaction_cents: 100, fee_cents: 30) } let(:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/searchable_spec.rb
Ruby
mit
8,966
main
25,045
# frozen_string_literal: true require "spec_helper" describe Purchase::Searchable do before do travel_to(Date.new(2019, 1, 1)) end describe "#indexed_json" do before do @product = create(:product, name: "My Product", user: create(:named_user)) @purchase = create(:purchase, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/creator_analytics_callbacks_spec.rb
Ruby
mit
8,966
main
1,416
# frozen_string_literal: true require "spec_helper" describe Purchase::CreatorAnalyticsCallbacks do context "when the purchase happened today" do it "does not queue job after update" do purchase = create(:purchase_in_progress) purchase.mark_successful! expect(RegenerateCreatorAnalyticsCacheWo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/purchase/custom_fields_spec.rb
Ruby
mit
8,966
main
2,021
# frozen_string_literal: true require "spec_helper" describe Purchase::CustomFields do let(:purchase) { create(:purchase) } describe "validations" do it "invalidates the purchase when a custom field is invalid" do product = create(:product, custom_fields: [create(:custom_field, name: "http://test", typ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/balance/refund_eligibility_underwriter_spec.rb
Ruby
mit
8,966
main
2,129
# frozen_string_literal: true require "spec_helper" describe Balance::RefundEligibilityUnderwriter do describe "#update_seller_refund_eligibility" do let(:user) { create(:user) } # Eagerly create this so `expect` block doesn't enqueue any jobs due to creating this. let!(:balance) { create(:balance, use...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/balance/searchable_spec.rb
Ruby
mit
8,966
main
1,297
# frozen_string_literal: true require "spec_helper" describe Balance::Searchable do describe "#as_indexed_json" do let(:balance) { create(:balance, amount_cents: 123, state: "unpaid") } it "includes all fields" do expect(balance.as_indexed_json).to eq( "user_id" => balance.user_id, "a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/concerns/offer_code/sorting_spec.rb
Ruby
mit
8,966
main
2,620
# frozen_string_literal: true require "spec_helper" describe OfferCode::Sorting do describe ".sorted_by" do let(:seller) { create(:named_seller) } let(:product1) { create(:product, name: "Product 1", user: seller, price_cents: 1000) } let(:product2) { create(:product, name: "Product 2", user: seller, pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/payment_option/installment_plan_snapshot_spec.rb
Ruby
mit
8,966
main
4,883
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/help_center/category_spec.rb
Ruby
mit
8,966
main
535
# 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::...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/admin/sales_report_spec.rb
Ruby
mit
8,966
main
9,612
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_json_spec.rb
Ruby
mit
8,966
main
5,428
# frozen_string_literal: true require "spec_helper" describe "InstallmentJson" 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 "#installment_mobile_js...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_tracking_spec.rb
Ruby
mit
8,966
main
3,375
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_filters_spec.rb
Ruby
mit
8,966
main
1,819
# frozen_string_literal: true require "spec_helper" require "shared_examples/with_filtering_support" describe "InstallmentFilters" 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:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_validations_spec.rb
Ruby
mit
8,966
main
6,252
# frozen_string_literal: true require "spec_helper" describe "InstallmentValidations" do describe "#validate_sending_limit_for_sellers" do before do stub_const("Installment::SENDING_LIMIT", 2) @seller = create(:user) @installment = build(:installment, seller: @seller) end context "whe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_class_methods_spec.rb
Ruby
mit
8,966
main
20,510
# frozen_string_literal: true require "spec_helper" describe "InstallmentClassMethods" 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 ".product_or_va...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_scopes_spec.rb
Ruby
mit
8,966
main
2,895
# frozen_string_literal: true require "spec_helper" describe "InstallmentScopes" 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 ".shown_on_profile" d...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/models/installment/installment_send_installment_spec.rb
Ruby
mit
8,966
main
22,133
# frozen_string_literal: true require "spec_helper" describe "InstallmentSendInstallment" 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 "publish" do...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/sales_tax/sales_tax_calculation_spec.rb
Ruby
mit
8,966
main
3,144
# frozen_string_literal: true require "spec_helper" describe SalesTaxCalculation do it "returns a valid object for the zero tax helper" do taxation_info = SalesTaxCalculation.zero_tax(100) expect(taxation_info.price_cents).to eq(100) expect(taxation_info.tax_cents).to eq(0) expect(taxation_info.zip...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/sales_tax/sales_tax_calculator_spec.rb
Ruby
mit
8,966
main
101,017
# frozen_string_literal: true require "spec_helper" describe SalesTaxCalculator do describe "input validation" do it "only accepts a hash for buyer location info" do expect do SalesTaxCalculator.new(product: create(:product), price_cents: 100, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/sales_tax/taxjar/taxjar_api_spec.rb
Ruby
mit
8,966
main
13,315
# frozen_string_literal: true require "spec_helper" describe TaxjarApi, :vcr do let(:origin) do { country: "US", state: "CA", zip: "94104" } end let(:destination) do { country: "US", state: "CA", zip: "94107" } end let(:nexus_address) do { coun...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/utilities/stripe_url_spec.rb
Ruby
mit
8,966
main
1,361
# frozen_string_literal: true require "spec_helper" describe StripeUrl do describe "dashboard_url" do describe "production" do before do allow(Rails.env).to receive(:production?).and_return(true) end after do allow(Rails.env).to receive(:production?).and_call_original en...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/utilities/stripe_metadata_spec.rb
Ruby
mit
8,966
main
6,120
# frozen_string_literal: true require "spec_helper" describe StripeMetadata do describe "build_metadata_large_list" do let(:key) { "myKey" } let(:items) { %w[asdfasdf asdfasdfasdfasdf] } it "returns a key-value pair hash of items" do expect(subject.build_metadata_large_list(items, key:)).to eq( ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/integrations/paypal_partner_rest_credentials_spec.rb
Ruby
mit
8,966
main
1,469
# frozen_string_literal: true describe PaypalPartnerRestCredentials do describe "#auth_token" do context "when a cached token is present" do before do @some_auth_token = "random token" allow_any_instance_of(described_class).to receive(:load_token).and_return(@some_auth_token) end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/integrations/paypal_integration_rest_api_spec.rb
Ruby
mit
8,966
main
1,099
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/payouts/payout_estimates_spec.rb
Ruby
mit
8,966
main
7,577
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/payouts/payouts_spec.rb
Ruby
mit
8,966
main
34,070
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/payouts/processor/stripe/stripe_payout_processor_spec.rb
Ruby
mit
8,966
main
157,964
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/payouts/processor/paypal/paypal_payout_processor_spec.rb
Ruby
mit
8,966
main
56,169
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
spec/business/payments/charging/chargeable_visual_spec.rb
Ruby
mit
8,966
main
1,830
# frozen_string_literal: true require "spec_helper" describe ChargeableVisual do describe "is_cc_visual" do describe "visual is a credit card" do let(:visual) { "**** **** **** 4242" } it "returns true" do expect(described_class.is_cc_visual(visual)).to eq(true) end end descr...