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/utm_link_driven_sale_spec.rb | Ruby | mit | 8,966 | main | 602 | # frozen_string_literal: true
require "spec_helper"
describe UtmLinkDrivenSale do
describe "associations" do
it { is_expected.to belong_to(:utm_link).optional(false) }
it { is_expected.to belong_to(:utm_link_visit).optional(false) }
it { is_expected.to belong_to(:purchase).optional(false) }
end
des... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/creator_contacting_customers_email_info_spec.rb | Ruby | mit | 8,966 | main | 2,085 | # frozen_string_literal: true
require "spec_helper"
describe CreatorContactingCustomersEmailInfo do
describe "state transitions" do
it "transitions to sent" do
email_info = create(:creator_contacting_customers_email_info)
email_info.update_attribute(:delivered_at, Time.current)
expect(email_in... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/imported_customer_spec.rb | Ruby | mit | 8,966 | main | 1,004 | # frozen_string_literal: true
require "spec_helper"
describe ImportedCustomer do
describe "validations" do
it "requires an email to create an ImportedCustomer" do
imported_customer_invalid = ImportedCustomer.new(email: nil)
expect(imported_customer_invalid).to_not be_valid
valid_customer = Imp... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/user_compliance_info_request_spec.rb | Ruby | mit | 8,966 | main | 8,461 | # frozen_string_literal: true
require "spec_helper"
describe UserComplianceInfoRequest do
describe "only_needs_field_to_be_partially_provided" do
let(:request_1) { create(:user_compliance_info_request, only_needs_field_to_be_partially_provided: true) }
let(:request_2) { create(:user_compliance_info_request,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/asset_preview_spec.rb | Ruby | mit | 8,966 | main | 15,722 | # frozen_string_literal: true
require "spec_helper"
describe AssetPreview, :vcr do
describe "Attachment" do
it "scales down a big image and keeps original" do
asset_preview = create(:asset_preview)
expect(asset_preview.file.url).to match("#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/#{asset_preview.file.key}")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,091 | # frozen_string_literal: true
require "spec_helper"
describe BankAccount do
describe "routing_number" do
let(:australian_bank_account) { build(:australian_bank_account) }
it "returns the decrypted account number" do
expect(australian_bank_account.send(:account_number_decrypted)).to eq("1234567")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/charge_purchase_spec.rb | Ruby | mit | 8,966 | main | 372 | # frozen_string_literal: true
require "spec_helper"
describe ChargePurchase do
describe "validations" do
it "validates presence of required attributes" do
charge_purchase = described_class.new
expect(charge_purchase).to be_invalid
expect(charge_purchase.errors.messages).to eq(charge: ["must e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/jamaica_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,532 | # frozen_string_literal: true
require "spec_helper"
describe JamaicaBankAccount do
describe "#bank_account_type" do
it "returns JM" do
expect(create(:jamaica_bank_account).bank_account_type).to eq("JM")
end
end
describe "#country" do
it "returns JM" do
expect(create(:jamaica_bank_accoun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/invite_spec.rb | Ruby | mit | 8,966 | main | 1,478 | # frozen_string_literal: true
require "spec_helper"
describe Invite do
describe "scopes" do
before do
@invite_sent = create(:invite)
@invite_signed_up = create(:invite, invite_state: "signed_up")
end
describe "#invitation_sent" do
it "returns only the records with sta... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/hungary_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,201 | # frozen_string_literal: true
require "spec_helper"
describe HungaryBankAccount do
describe "#bank_account_type" do
it "returns hungary" do
expect(create(:hungary_bank_account).bank_account_type).to eq("HU")
end
end
describe "#country" do
it "returns HU" do
expect(create(:hungary_bank_a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/custom_field_spec.rb | Ruby | mit | 8,966 | main | 2,127 | # frozen_string_literal: true
require "spec_helper"
describe CustomField do
describe "#as_json" do
it "returns the correct data" do
product = create(:product)
field = create(:custom_field, products: [product])
expect(field.as_json).to eq({
id: field.external... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/variant_price_spec.rb | Ruby | mit | 8,966 | main | 3,537 | # frozen_string_literal: true
require "spec_helper"
describe VariantPrice do
describe "associations" do
it "belongs to a variant" do
price = create(:variant_price)
expect(price.variant).to be_a Variant
end
end
describe "validations" do
it "requires that the variant is present" do
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/moldova_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,683 | # frozen_string_literal: true
require "spec_helper"
describe MoldovaBankAccount do
describe "#bank_account_type" do
it "returns MD" do
expect(create(:moldova_bank_account).bank_account_type).to eq("MD")
end
end
describe "#country" do
it "returns MD" do
expect(create(:moldova_bank_accoun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/saudi_arabia_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,396 | # frozen_string_literal: true
require "spec_helper"
describe SaudiArabiaBankAccount do
describe "#bank_account_type" do
it "returns SA" do
expect(create(:saudi_arabia_bank_account).bank_account_type).to eq("SA")
end
end
describe "#country" do
it "returns SA" do
expect(create(:saudi_arab... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/panama_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,264 | # frozen_string_literal: true
require "spec_helper"
describe PanamaBankAccount do
describe "#bank_account_type" do
it "returns PA" do
expect(create(:panama_bank_account).bank_account_type).to eq("PA")
end
end
describe "#country" do
it "returns PA" do
expect(create(:panama_bank_account).... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/rwanda_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,535 | # frozen_string_literal: true
describe RwandaBankAccount do
describe "#bank_account_type" do
it "returns RW" do
expect(create(:rwanda_bank_account).bank_account_type).to eq("RW")
end
end
describe "#country" do
it "returns RW" do
expect(create(:rwanda_bank_account).country).to eq("RW")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/email_event_spec.rb | Ruby | mit | 8,966 | main | 8,770 | # frozen_string_literal: true
require "spec_helper"
describe EmailEvent do
let(:emails) { ["one@example.com", "two@example.com", "three@example.com"] }
let(:emails_digests) { emails.map { Digest::SHA1.hexdigest(_1).first(12) } }
let(:email) { emails.first }
let(:email_digest) { emails_digests.first }
let(:t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_file_spec.rb | Ruby | mit | 8,966 | main | 46,182 | # frozen_string_literal: true
require "spec_helper"
describe ProductFile do
describe ".archivable" do
it "only includes archivable files" do
create(:streamable_video)
create(:readable_document)
create(:listenable_audio)
create(:non_readable_document)
create(:external_link)
cr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/purchase_custom_field_spec.rb | Ruby | mit | 8,966 | main | 6,524 | # frozen_string_literal: true
require "spec_helper"
describe PurchaseCustomField do
describe "validations" do
it "validates field type is a custom field type" do
purchase_custom_field = described_class.new(field_type: "invalid")
expect(purchase_custom_field).not_to be_valid
expect(purchase_cus... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/israel_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,174 | # frozen_string_literal: true
require "spec_helper"
describe IsraelBankAccount do
describe "#bank_account_type" do
it "returns IL" do
expect(create(:israel_bank_account).bank_account_type).to eq("IL")
end
end
describe "#country" do
it "returns IL" do
expect(create(:israel_bank_account).... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/gabon_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,374 | # frozen_string_literal: true
describe GabonBankAccount do
describe "#bank_account_type" do
it "returns GA" do
expect(create(:gabon_bank_account).bank_account_type).to eq("GA")
end
end
describe "#country" do
it "returns GA" do
expect(create(:gabon_bank_account).country).to eq("GA")
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/balance_spec.rb | Ruby | mit | 8,966 | main | 2,083 | # frozen_string_literal: true
require "spec_helper"
describe Balance do
let(:user) { create(:user) }
let(:merchant_account) { create(:merchant_account, user:) }
describe "validate_amounts_are_only_changed_when_unpaid" do
let(:balance) { create(:balance, user:, merchant_account:, date: Date.today) }
de... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/san_marino_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,378 | # frozen_string_literal: true
require "spec_helper"
describe SanMarinoBankAccount do
describe "#bank_account_type" do
it "returns SM" do
expect(create(:san_marino_bank_account).bank_account_type).to eq("SM")
end
end
describe "#country" do
it "returns SM" do
expect(create(:san_marino_ban... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/user_compliance_info_spec.rb | Ruby | mit | 8,966 | main | 18,078 | # frozen_string_literal: true
require "spec_helper"
describe UserComplianceInfo do
describe "encrypted" do
describe "individual_tax_id" do
let(:user_compliance_info) { create(:user_compliance_info, individual_tax_id: "123456789") }
it "is encrypted" do
expect(user_compliance_info.individual... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/offer_code_spec.rb | Ruby | mit | 8,966 | main | 35,800 | # frozen_string_literal: true
require "spec_helper"
require "shared_examples/max_purchase_count_concern"
describe OfferCode do
before do
@product = create(:product, user: create(:user), price_cents: 2000, price_currency_type: "usd")
end
it_behaves_like "MaxPurchaseCount concern", :offer_code
describe "c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/gift_spec.rb | Ruby | mit | 8,966 | main | 803 | # frozen_string_literal: true
require "spec_helper"
describe Gift do
describe "saving" do
it "removes leading/trailing spaces in emails" do
gift = create(:gift, gifter_email: " abc@def.com ", giftee_email: " foo@bar.com ")
expect(gift.gifter_email).to eq("abc@def.com")
expect(gift.giftee_email... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/sales_export_spec.rb | Ruby | mit | 8,966 | main | 348 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe SalesExport do
describe "#destroy" do
it "deletes chunks" do
export = create(:sales_export)
create(:sales_export_chunk, export:)
expect(SalesExportChunk.count).to eq(1)
export.destroy!
expect(SalesExportChunk.count)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/user_tax_form_spec.rb | Ruby | mit | 8,966 | main | 1,167 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe UserTaxForm do
subject(:user_tax_form) { build(:user_tax_form) }
describe "associations" do
it { is_expected.to belong_to(:user) }
end
describe "validations" do
it { is_expected.to validate_presence_of(:tax_year) }
it { is_expect... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/blocked_customer_object_spec.rb | Ruby | mit | 8,966 | main | 6,249 | # frozen_string_literal: true
require "spec_helper"
describe BlockedCustomerObject do
describe "validations" do
subject(:blocked_customer_object) { build(:blocked_customer_object, object_type: nil, object_value: nil) }
describe "presence" do
it "doesn't allow an empty seller_id" do
blocked_cu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/email_info_charge.rb | Ruby | mit | 8,966 | main | 445 | # frozen_string_literal: true
require "spec_helper"
describe EmailInfoCharge do
describe "validations" do
it "requires charge_id and email_info_id" do
email_info_charge = EmailInfoCharge.new
expect(email_info_charge).to_not be_valid
expect(email_info_charge.errors.full_messages).to include("Ch... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/totp_credential_spec.rb | Ruby | mit | 8,966 | main | 4,402 | # frozen_string_literal: true
require "spec_helper"
describe TotpCredential do
let(:user) { create(:user) }
describe "validations" do
it "requires a user" do
credential = TotpCredential.new
expect(credential).not_to be_valid
expect(credential.errors[:user]).to be_present
end
it "en... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/sent_email_info_spec.rb | Ruby | mit | 8,966 | main | 3,067 | # frozen_string_literal: true
require "spec_helper"
describe SentEmailInfo do
describe "validations" do
it "doesn't allow empty keys" do
expect do
SentEmailInfo.set_key!(nil)
end.to raise_error(ActiveRecord::RecordInvalid)
end
it "doesn't allow duplicate keys" do
SentEmailInfo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/media_location_spec.rb | Ruby | mit | 8,966 | main | 3,861 | # frozen_string_literal: true
require "spec_helper"
describe MediaLocation do
describe "#create" do
before do
@url_redirect = create(:readable_url_redirect)
@product = @url_redirect.referenced_link
end
it "raises error if platform is invalid" do
media_location = build(:media_location,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/albania_bank_account_spec.rb | Ruby | mit | 8,966 | main | 906 | # frozen_string_literal: true
describe AlbaniaBankAccount do
describe "#bank_account_type" do
it "returns AL" do
expect(create(:albania_bank_account).bank_account_type).to eq("AL")
end
end
describe "#country" do
it "returns AL" do
expect(create(:albania_bank_account).country).to eq("AL")... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/global_affiliate_spec.rb | Ruby | mit | 8,966 | main | 6,427 | # frozen_string_literal: true
require "spec_helper"
describe GlobalAffiliate do
describe "validations" do
describe "affiliate_basis_points" do
it "requires affiliate_basis_points to be present" do
affiliate = create(:user).global_affiliate # sets affiliate basis points in pre-validation hook on cr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/variant_category_spec.rb | Ruby | mit | 8,966 | main | 5,235 | # frozen_string_literal: true
require "spec_helper"
describe VariantCategory do
describe "scopes" do
describe ".is_tier_category" do
it "returns variant categories with title 'Tier'" do
create(:variant_category)
tier_category = create(:variant_category, title: "Tier")
second_tier_c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_cached_value_spec.rb | Ruby | mit | 8,966 | main | 2,973 | # frozen_string_literal: true
describe ProductCachedValue do
describe "#create" do
it "is valid with a product" do
expect(build(:product_cached_value, product: create(:product))).to be_valid
end
it "is invalid without a product" do
expect(build(:product_cached_value, product: nil)).to_not be... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/hong_kong_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,874 | # frozen_string_literal: true
require "spec_helper"
describe HongKongBankAccount do
describe "#bank_account_type" do
it "returns hong kong" do
expect(create(:hong_kong_bank_account).bank_account_type).to eq("HK")
end
end
describe "#country" do
it "returns HK" do
expect(create(:hong_kong... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_review_stat_spec.rb | Ruby | mit | 8,966 | main | 5,601 | # frozen_string_literal: true
require "spec_helper"
describe ProductReviewStat do
describe "#rating_counts" do
it "returns counts of ratings" do
review_stat = build(:product_review_stat, ratings_of_one_count: 7, ratings_of_three_count: 11)
expect(review_stat.rating_counts).to eq(1 => 7, 2 => 0, 3 =>... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/cached_sales_related_products_info_spec.rb | Ruby | mit | 8,966 | main | 1,060 | # frozen_string_literal: true
require "spec_helper"
describe CachedSalesRelatedProductsInfo do
describe "validations" do
it "validates counts column format" do
record = build(:cached_sales_related_products_info, counts: { "123" => "bar" })
expect(record).to be_invalid
expect(record.errors[:cou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/taiwan_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,341 | # frozen_string_literal: true
require "spec_helper"
describe TaiwanBankAccount do
describe "#bank_account_type" do
it "returns Taiwan" do
expect(create(:taiwan_bank_account).bank_account_type).to eq("TW")
end
end
describe "#country" do
it "returns TW" do
expect(create(:taiwan_bank_accou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/norway_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,158 | # frozen_string_literal: true
require "spec_helper"
describe NorwayBankAccount do
describe "#bank_account_type" do
it "returns NO" do
expect(create(:norway_bank_account).bank_account_type).to eq("NO")
end
end
describe "#country" do
it "returns NO" do
expect(create(:norway_bank_account).... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/indonesia_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,486 | # frozen_string_literal: true
describe IndonesiaBankAccount do
describe "#bank_account_type" do
it "returns Indonesia" do
expect(create(:indonesia_bank_account).bank_account_type).to eq("ID")
end
end
describe "#country" do
it "returns ID" do
expect(create(:indonesia_bank_account).country... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/liechtenstein_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,251 | # frozen_string_literal: true
require "spec_helper"
describe LiechtensteinBankAccount do
describe "#bank_account_type" do
it "returns LI" do
expect(create(:liechtenstein_bank_account).bank_account_type).to eq("LI")
end
end
describe "#country" do
it "returns LI" do
expect(create(:liechte... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/zoom_integration_spec.rb | Ruby | mit | 8,966 | main | 3,103 | # frozen_string_literal: true
require "spec_helper"
describe ZoomIntegration do
it "creates the correct json details" do
integration = create(:zoom_integration)
ZoomIntegration::INTEGRATION_DETAILS.each do |detail|
expect(integration.respond_to?(detail)).to eq true
end
end
it "saves details c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/costa_rica_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,039 | # frozen_string_literal: true
describe CostaRicaBankAccount do
describe "#bank_account_type" do
it "returns Costa Rica" do
expect(create(:costa_rica_bank_account).bank_account_type).to eq("CR")
end
end
describe "#country" do
it "returns CR" do
expect(create(:costa_rica_bank_account).coun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/seller_profile_rich_text_section_spec.rb | Ruby | mit | 8,966 | main | 1,183 | # frozen_string_literal: true
require "spec_helper"
describe SellerProfileRichTextSection do
describe "validations" do
it "validates json_data with the correct schema" do
section = build(:seller_profile_rich_text_section)
section.json_data["garbage"] = "should not be here"
schema = JSON.parse(... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_review_response_spec.rb | Ruby | mit | 8,966 | main | 699 | # frozen_string_literal: true
require "spec_helper"
describe ProductReviewResponse do
let(:product_review) { create(:product_review) }
describe "validations" do
it { is_expected.to validate_presence_of(:message) }
end
describe "after_create_commit" do
it "sends an email to the reviewer after creatio... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/indian_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,317 | # frozen_string_literal: true
require "spec_helper"
describe IndianBankAccount do
describe "#bank_account_type" do
it "returns Indian" do
expect(create(:indian_bank_account).bank_account_type).to eq("IN")
end
end
describe "#country" do
it "returns IN" do
expect(create(:indian_bank_accou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/bundle_product_spec.rb | Ruby | mit | 8,966 | main | 6,749 | # frozen_string_literal: true
require "spec_helper"
describe BundleProduct do
describe "#standalone_price_cents" do
let(:bundle_product) { create(:bundle_product, quantity: 2) }
it "returns the correct price" do
expect(bundle_product.standalone_price_cents).to eq(200)
end
context "when the p... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/device_spec.rb | Ruby | mit | 8,966 | main | 1,370 | # frozen_string_literal: true
require "spec_helper"
describe Device do
describe "creating" do
it "deletes existing token if already linked with other account" do
device = create(:device, token: "x" * 64, device_type: "ios")
create(:device, token: "x" * 64, device_type: "ios")
expect(Device.whe... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/wishlist_spec.rb | Ruby | mit | 8,966 | main | 4,863 | # frozen_string_literal: true
require "spec_helper"
describe Wishlist do
describe "#find_by_url_slug" do
let(:wishlist) { create(:wishlist) }
it "finds a wishlist" do
expect(Wishlist.find_by_url_slug(wishlist.url_slug)).to eq(wishlist)
end
it "returns nil when the wishlist does not exist" do... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/wishlist_follower_spec.rb | Ruby | mit | 8,966 | main | 1,133 | # frozen_string_literal: true
require "spec_helper"
describe WishlistFollower do
describe "validations" do
it "validates uniqueness of follower" do
wishlist = create(:wishlist)
user = create(:buyer_user)
first_follower = create(:wishlist_follower, wishlist:, follower_user: user)
second_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/confirmed_follower_event_spec.rb | Ruby | mit | 8,966 | main | 3,873 | # frozen_string_literal: true
require "spec_helper"
describe ConfirmedFollowerEvent 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: {
"followed_user_id" => 123,
"name"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/discord_integration_spec.rb | Ruby | mit | 8,966 | main | 5,464 | # frozen_string_literal: true
require "spec_helper"
describe DiscordIntegration do
it "creates the correct json details" do
integration = create(:discord_integration)
DiscordIntegration::INTEGRATION_DETAILS.each do |detail|
expect(integration.respond_to?(detail)).to eq true
end
end
it "saves ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/bhutan_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,574 | # frozen_string_literal: true
describe BhutanBankAccount do
describe "#bank_account_type" do
it "returns BT" do
expect(create(:bhutan_bank_account).bank_account_type).to eq("BT")
end
end
describe "#country" do
it "returns BT" do
expect(create(:bhutan_bank_account).country).to eq("BT")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/mongolia_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,946 | # frozen_string_literal: true
require "spec_helper"
describe MongoliaBankAccount do
describe "#bank_account_type" do
it "returns MN" do
expect(create(:mongolia_bank_account).bank_account_type).to eq("MN")
end
end
describe "#country" do
it "returns MN" do
expect(create(:mongolia_bank_acc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_review_video_spec.rb | Ruby | mit | 8,966 | main | 988 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe ProductReviewVideo, type: :model do
describe "approval status transitions" do
let(:product_review) { create(:product_review) }
let!(:pending_video) { create(:product_review_video, :pending_review, product_review:) }
let!(:approved_video)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/wishlist_product_spec.rb | Ruby | mit | 8,966 | main | 6,831 | # frozen_string_literal: true
require "spec_helper"
describe WishlistProduct do
describe "validations" do
let(:wishlist) { create(:wishlist) }
let(:product) { create(:product) }
let(:wishlist_product) { described_class.new(wishlist:, product:) }
it "validates the product is unique in the wishlist" ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/antigua_and_barbuda_bank_account_spec.rb | Ruby | mit | 8,966 | main | 3,007 | # frozen_string_literal: true
describe AntiguaAndBarbudaBankAccount do
describe "#bank_account_type" do
it "returns AG" do
expect(create(:antigua_and_barbuda_bank_account).bank_account_type).to eq("AG")
end
end
describe "#country" do
it "returns AG" do
expect(create(:antigua_and_barbuda_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/upsell_variant_spec.rb | Ruby | mit | 8,966 | main | 1,197 | # frozen_string_literal: true
require "spec_helper"
describe UpsellVariant do
describe "validations" do
context "when the variants don't belong to the upsell's offered product" do
before do
@upsell_variant = build(:upsell_variant, selected_variant: create(:variant), offered_variant: create(:varian... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/oman_bank_account_spec.rb | Ruby | mit | 8,966 | main | 3,696 | # frozen_string_literal: true
describe OmanBankAccount do
describe "#bank_account_type" do
it "returns OM" do
expect(create(:oman_bank_account).bank_account_type).to eq("OM")
end
end
describe "#country" do
it "returns OM" do
expect(create(:oman_bank_account).country).to eq("OM")
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/shipping_destination_spec.rb | Ruby | mit | 8,966 | main | 15,363 | # frozen_string_literal: true
require "spec_helper"
describe ShippingDestination do
before :each do
@product = create(:product)
end
it "it does not allow saving if the country code is nil or invalid" do
@product.shipping_destinations << ShippingDestination.new(country_code: "dummy",
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/algeria_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,697 | # frozen_string_literal: true
describe AlgeriaBankAccount do
describe "#bank_account_type" do
it "returns DZ" do
expect(create(:algeria_bank_account).bank_account_type).to eq("DZ")
end
end
describe "#country" do
it "returns DZ" do
expect(create(:algeria_bank_account).country).to eq("DZ")... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/cote_d_ivoire_bank_account_spec.rb | Ruby | mit | 8,966 | main | 866 | # frozen_string_literal: true
describe CoteDIvoireBankAccount do
describe "#bank_account_type" do
it "returns CI" do
expect(create(:cote_d_ivoire_bank_account).bank_account_type).to eq("CI")
end
end
describe "#country" do
it "returns CI" do
expect(create(:cote_d_ivoire_bank_account).coun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/license_spec.rb | Ruby | mit | 8,966 | main | 4,358 | # frozen_string_literal: true
require "spec_helper"
require "digest"
describe License do
describe "validations" do
it "does not allow users to unset token" do
license = create(:license)
license.serial = nil
expect(license).to_not be_valid
end
it "populates serial correctly on new lice... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/chile_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,461 | # frozen_string_literal: true
describe ChileBankAccount do
describe "#bank_account_type" do
it "returns Chile" do
expect(create(:chile_bank_account).bank_account_type).to eq("CL")
end
end
describe "#country" do
it "returns CL" do
expect(create(:chile_bank_account).country).to eq("CL")
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/team_invitation_spec.rb | Ruby | mit | 8,966 | main | 3,210 | # frozen_string_literal: true
require "spec_helper"
describe TeamInvitation do
let(:seller) { create(:named_seller) }
describe "validations" do
it "requires seller, email, role to be present" do
team_invitation = TeamInvitation.new
expect(team_invitation.valid?).to eq(false)
expect(team_inv... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/north_macedonia_bank_account_spec.rb | Ruby | mit | 8,966 | main | 3,794 | # frozen_string_literal: true
describe NorthMacedoniaBankAccount do
describe "#bank_account_type" do
it "returns Macedonia" do
expect(create(:north_macedonia_bank_account).bank_account_type).to eq("MK")
end
end
describe "#country" do
it "returns MK" do
expect(create(:north_macedonia_bank... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/subscription_spec.rb | Ruby | mit | 8,966 | main | 187,975 | # frozen_string_literal: true
require "spec_helper"
describe Subscription, :vcr do
include CurrencyHelper
include ManageSubscriptionHelpers
let(:seller) { create(:user) }
before do
@product = create(:subscription_product, user: seller, is_licensed: true)
@subscription = create(:subscription, user: c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/follower_spec.rb | Ruby | mit | 8,966 | main | 10,553 | # frozen_string_literal: true
require "spec_helper"
require "shared_examples/deletable_concern"
RSpec.describe Follower do
it_behaves_like "Deletable concern", :follower
let(:active_follower) { create(:active_follower) }
let(:deleted_follower) { create(:deleted_follower) }
let(:unconfirmed_follower) { create... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/seller_profile_products_section_spec.rb | Ruby | mit | 8,966 | main | 1,398 | # frozen_string_literal: true
require "spec_helper"
describe SellerProfileProductsSection do
describe "validations" do
it "validates json_data with the correct schema" do
section = build(:seller_profile_products_section, shown_products: [create(:product, name: "Product 1").id])
section.json_data["ga... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/stripe_apple_pay_domain_spec.rb | Ruby | mit | 8,966 | main | 334 | # frozen_string_literal: true
require "spec_helper"
describe StripeApplePayDomain do
it "validates presence of attributes" do
record = StripeApplePayDomain.create()
expect(record.errors.messages).to eq(
user: ["can't be blank"],
domain: ["can't be blank"],
stripe_id: ["can't be blank"],
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/call_spec.rb | Ruby | mit | 8,966 | main | 13,056 | # frozen_string_literal: true
require "sidekiq/testing"
describe Call do
let(:link) { create(:call_product, :available_for_a_year) }
let(:call_limitation_info) { link.call_limitation_info }
describe "normalizations", :freeze_time do
before { travel_to(DateTime.parse("May 1 2024 UTC")) }
it "drops sub-... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/purchase_integration_spec.rb | Ruby | mit | 8,966 | main | 4,271 | # frozen_string_literal: true
require "spec_helper"
describe PurchaseIntegration do
describe "validations" do
it "raises error if purchase_id is not present" do
purchase_integration = build(:purchase_integration, purchase_id: nil, integration_id: create(:discord_integration).id)
expect(purchase_inte... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_affiliate_spec.rb | Ruby | mit | 8,966 | main | 5,588 | # frozen_string_literal: true
require "spec_helper"
describe ProductAffiliate do
describe "associations" do
it { is_expected.to belong_to(:affiliate) }
it { is_expected.to belong_to(:product).class_name("Link") }
end
describe "validations" do
context "when another record exists" do
it "valida... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/australian_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,529 | # frozen_string_literal: true
require "spec_helper"
describe AustralianBankAccount do
describe "bsb_number" do
describe "is 6 digits" do
let(:australian_bank_account) { build(:australian_bank_account, bsb_number: "062111") }
it "is valid" do
expect(australian_bank_account).to be_valid
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/direct_affiliate_spec.rb | Ruby | mit | 8,966 | main | 29,362 | # frozen_string_literal: true
require "spec_helper"
describe DirectAffiliate do
let(:product) { create(:product, price_cents: 10_00, unique_permalink: "p") }
let(:seller) { product.user }
let(:affiliate_user) { create(:affiliate_user) }
let(:direct_affiliate) { create(:direct_affiliate, affiliate_user:, selle... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/utm_link_spec.rb | Ruby | mit | 8,966 | main | 20,005 | # frozen_string_literal: true
require "spec_helper"
describe UtmLink do
describe "associations" do
it { is_expected.to belong_to(:seller).class_name("User").optional(false) }
it { is_expected.to belong_to(:target_resource).optional(true) }
it { is_expected.to have_many(:utm_link_visits).dependent(:destr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/thumbnail_spec.rb | Ruby | mit | 8,966 | main | 5,309 | # frozen_string_literal: true
require "spec_helper"
describe Thumbnail do
before do
@product = create(:product)
end
describe "#validate_file" do
it "does not save if no file attached" do
thumbnail = Thumbnail.new(product: @product)
expect(thumbnail.save).to eq(false)
expect(thumbnail.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/country_spec.rb | Ruby | mit | 8,966 | main | 41,678 | # frozen_string_literal: true
describe Country do
describe "#supports_stripe_cross_border_payouts?" do
it "returns true if country only supports cross-border payouts via stripe otherwise returns false" do
expect(Country.new("US").supports_stripe_cross_border_payouts?).to be false
expect(Country.new("... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/peru_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,157 | # frozen_string_literal: true
require "spec_helper"
describe PeruBankAccount do
describe "#bank_account_type" do
it "returns peru" do
expect(create(:peru_bank_account).bank_account_type).to eq("PE")
end
end
describe "#country" do
it "returns PE" do
expect(create(:peru_bank_account).coun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/cart_spec.rb | Ruby | mit | 8,966 | main | 6,635 | # frozen_string_literal: true
require "spec_helper"
describe Cart do
describe "associations" do
describe "#alive_cart_products" do
it "returns only alive cart products" do
cart = create(:cart)
alive_cart_product = create(:cart_product, cart:)
create(:cart_product, cart:, deleted_at... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/thailand_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,419 | # frozen_string_literal: true
require "spec_helper"
describe ThailandBankAccount do
describe "#bank_account_type" do
it "returns thailand" do
expect(create(:thailand_bank_account).bank_account_type).to eq("TH")
end
end
describe "#country" do
it "returns TH" do
expect(create(:thailand_ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/dominican_republic_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,006 | # frozen_string_literal: true
require "spec_helper"
describe DominicanRepublicBankAccount do
let(:bank_account) { build(:dominican_republic_bank_account) }
describe "#bank_account_type" do
it "returns DO" do
expect(bank_account.bank_account_type).to eq("DO")
end
end
describe "#country" do
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/canadian_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,715 | # frozen_string_literal: true
require "spec_helper"
describe CanadianBankAccount do
describe "transit_number" do
describe "is 5 digits" do
let(:canadian_bank_account) { build(:canadian_bank_account, transit_number: "12345") }
it "is valid" do
expect(canadian_bank_account).to be_valid
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/user_spec.rb | Ruby | mit | 8,966 | main | 144,246 | # frozen_string_literal: true
require "spec_helper"
require "shared_examples/versionable_concern"
describe User, :vcr do
it_behaves_like "Versionable concern", :user, {
email: %w(old@example.com),
payment_address: %w(old-paypal@example.com paypal@example.com)
}
describe "associations" do
before :ea... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/el_salvador_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,066 | # frozen_string_literal: true
require "spec_helper"
describe ElSalvadorBankAccount do
describe "#bank_account_type" do
it "returns SV" do
expect(create(:el_salvador_bank_account).bank_account_type).to eq("SV")
end
end
describe "#country" do
it "returns SV" do
expect(create(:el_salvador_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/team_membership_spec.rb | Ruby | mit | 8,966 | main | 2,824 | # frozen_string_literal: true
require "spec_helper"
describe TeamMembership do
describe "validations" do
let(:user) { create(:user) }
let(:seller) { create(:named_seller) }
it "requires user, seller, role to be present" do
team_membership = TeamMembership.new
expect(team_membership.valid?).... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/azerbaijan_bank_account_spec.rb | Ruby | mit | 8,966 | main | 1,798 | # frozen_string_literal: true
require "spec_helper"
describe AzerbaijanBankAccount do
describe "#bank_account_type" do
it "returns AZ" do
expect(create(:azerbaijan_bank_account).bank_account_type).to eq("AZ")
end
end
describe "#country" do
it "returns AZ" do
expect(create(:azerbaijan_ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/installment_plan_snapshot_spec.rb | Ruby | mit | 8,966 | main | 5,579 | # frozen_string_literal: true
require "spec_helper"
describe InstallmentPlanSnapshot do
let(:subscription) { create(:subscription) }
let(:payment_option) { create(:payment_option, subscription: subscription) }
describe "associations" do
it "belongs to payment_option" do
snapshot = build(:installment_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/utm_link_visit_spec.rb | Ruby | mit | 8,966 | main | 574 | # frozen_string_literal: true
require "spec_helper"
describe UtmLinkVisit do
describe "associations" do
it { is_expected.to belong_to(:utm_link) }
it { is_expected.to belong_to(:user).optional }
it { is_expected.to have_many(:utm_link_driven_sales).dependent(:destroy) }
it { is_expected.to have_many... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/ethiopia_bank_account_spec.rb | Ruby | mit | 8,966 | main | 2,232 | # frozen_string_literal: true
describe EthiopiaBankAccount do
describe "#bank_account_type" do
it "returns ET" do
expect(create(:ethiopia_bank_account).bank_account_type).to eq("ET")
end
end
describe "#country" do
it "returns ET" do
expect(create(:ethiopia_bank_account).country).to eq("E... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/seller_profile_posts_section_spec.rb | Ruby | mit | 8,966 | main | 938 | # frozen_string_literal: true
require "spec_helper"
describe SellerProfilePostsSection do
describe "validations" do
it "validates json_data with the correct schema" do
section = build(:seller_profile_posts_section, shown_posts: [1])
section.json_data["garbage"] = "should not be here"
schema = ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/variant_spec.rb | Ruby | mit | 8,966 | main | 34,703 | # frozen_string_literal: true
require "spec_helper"
require "shared_examples/max_purchase_count_concern"
describe Variant do
it_behaves_like "MaxPurchaseCount concern", :variant
describe "lifecycle hooks" do
describe "before_validation :strip_subscription_price_change_message" do
it "ensures text is pr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/cart_product_spec.rb | Ruby | mit | 8,966 | main | 3,186 | # frozen_string_literal: true
require "spec_helper"
describe CartProduct do
describe "callbacks" do
it "assigns default url parameters after initialization" do
cart_product = build(:cart_product)
expect(cart_product.url_parameters).to eq({})
end
it "assigns accepted offer details after init... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/product_review_spec.rb | Ruby | mit | 8,966 | main | 5,929 | # frozen_string_literal: true
require "spec_helper"
describe ProductReview do
it "enforces the rating to lie within a specific range" do
ProductReview::PRODUCT_RATING_RANGE.each do |rating|
expect(create(:product_review, rating:)).to be_valid
end
product_review = build(:product_review, rating: 0)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/google_calendar_integration_spec.rb | Ruby | mit | 8,966 | main | 3,840 | # frozen_string_literal: true
require "spec_helper"
describe GoogleCalendarIntegration do
it "creates the correct json details" do
integration = create(:google_calendar_integration)
GoogleCalendarIntegration::INTEGRATION_DETAILS.each do |detail|
expect(integration.respond_to?(detail)).to eq true
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/refund_spec.rb | Ruby | mit | 8,966 | main | 775 | # frozen_string_literal: true
require "spec_helper"
describe Refund do
it "validates that processor_refund_id is unique" do
create(:refund, processor_refund_id: "ref_id")
new_ref = build(:refund, processor_refund_id: "ref_id")
expect(new_ref.valid?).to_not be(true)
end
describe "flags" do
it "... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | spec/models/zip_tax_rate_spec.rb | Ruby | mit | 8,966 | main | 1,314 | # frozen_string_literal: true
require "spec_helper"
describe ZipTaxRate do
it "requires a combined rate" do
ztr = ZipTaxRate.new(zip_code: "90210", country: "US", state: "CA", is_seller_responsible: true)
expect(ztr).to_not be_valid
end
describe "flags" do
it "has `is_seller_responsible` flag" do
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.