Sha256: f68fdba50fa21176ed520aafd0403948bdf9c3c8d2f8b9dbca0c8f9b4efdc335

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

require 'rails_helper'

module Tang
  describe CreateInvoice do
    before { StripeMock.start }
    after { StripeMock.stop }
  
    it "creates a new invoice for a subscription" do
      subscription = FactoryBot.create(:subscription)
      event = StripeMock.mock_webhook_event('invoice.created', customer: subscription.customer.stripe_id, subscription: subscription.stripe_id)

      count = Invoice.count
      
      invoice = CreateInvoice.call(event)

      expect(Invoice.count).to eq count + 1

      expect(invoice.subscription.id).to eq subscription.id
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tang-0.2.1 spec/services/tang/create_invoice_spec.rb
tang-0.2.0 spec/services/tang/create_invoice_spec.rb
tang-0.1.0 spec/services/tang/create_invoice_spec.rb
tang-0.0.9 spec/services/tang/create_invoice_spec.rb
tang-0.0.8 spec/services/tang/create_invoice_spec.rb