Sha256: e21306187666187e45f7a271e9c917adee789a7212233a6b28db83ea820dce25
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require 'rails_helper' module Tang RSpec.describe Customer do let(:stripe_helper) { StripeMock.create_test_helper } before { StripeMock.start } after { StripeMock.stop } it "responds to admin?" do customer = FactoryBot.create(:customer) admin = FactoryBot.create(:admin) expect(customer.admin?).to be_falsey expect(admin.admin?).to be_truthy end it "generates a password" do customer = FactoryBot.build(:customer, password: nil) customer.generate_password expect(customer.password).to_not be_nil end it "is subscribed to a plan" do subscription = FactoryBot.create(:subscription) stripe_id = subscription.plan.stripe_id expect(subscription.customer.subscribed_to?(stripe_id)).to be_truthy end it "is not subscribed to a plan" do subscription = FactoryBot.create(:subscription) plan = FactoryBot.create(:premium_plan) stripe_id = plan.stripe_id expect(subscription.customer.subscribed_to?(stripe_id)).to be_falsey end end end
Version data entries
5 entries across 5 versions & 1 rubygems