Sha256: 9717ced96581c4ea347dc8561516d8a08a4a88ddafd869154d5dc4ae85b81e1f
Contents?: true
Size: 835 Bytes
Versions: 5
Compression:
Stored size: 835 Bytes
Contents
require 'rails_helper' module Tang RSpec.describe Invoice, type: :model do let(:stripe_helper) { StripeMock.create_test_helper } before { StripeMock.start } after { StripeMock.stop } it "has a valid factory" do expect(FactoryBot.create(:invoice)).to be_valid end it "is invalid without a customer" do expect(FactoryBot.build(:invoice, customer: nil)).to be_invalid end it "is invalid without a stripe id" do expect(FactoryBot.build(:invoice, stripe_id: nil)).to be_invalid end it "is paid if a charge is present" do charge = FactoryBot.create(:charge) expect(charge.invoice.status).to eq('paid') end it "is unpaid if no charge is present" do invoice = FactoryBot.create(:invoice) expect(invoice.status).to eq('unpaid') end end end
Version data entries
5 entries across 5 versions & 1 rubygems