Skip to content

Commit

Permalink
Fix invoice specs after invoice factory changes (#1872)
Browse files Browse the repository at this point in the history
- By default, all invoices created are `draft` to avoid flakyness
- This is fixed in PR #1870

Co-authored-by: Nishant Samel <[email protected]>
  • Loading branch information
nisusam and Nishant Samel authored Jul 9, 2024
1 parent 88c4a92 commit 8857b02
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions spec/requests/internal_api/v1/invoices/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
invoice_number: "SAI-C1-03",
client: company.clients.first,
client_id: company.clients.first.id,
status: :draft,
invoice_line_item: {
name: "Test",
description: "test description",
Expand Down Expand Up @@ -72,7 +71,6 @@
:invoice,
client: company.clients.first,
client_id: company.clients.first.id,
status: :draft,
invoice_line_item: {
name: "Test",
description: "test description",
Expand All @@ -99,7 +97,6 @@
:invoice,
client: company.clients.first,
client_id: company.clients.first.id,
status: :draft,
invoice_line_item: {
name: "Test",
description: "test description",
Expand All @@ -122,8 +119,7 @@
invoice: attributes_for(
:invoice,
client: company.clients.first,
client_id: company.clients.first.id,
status: :draft
client_id: company.clients.first.id
)
)
expect(response).to have_http_status(:unauthorized)
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/internal_api/v1/payments/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let!(:client1_viewed_invoice1) { create(:invoice, client: client1, company:, status: "viewed") }
let!(:client1_paid_invoice1) { create(:invoice, client: client1, company:, status: "paid") }
let!(:client1_overdue_invoice1) { create(:invoice, client: client1, company:, status: "overdue") }
let!(:client1_draft_invoice1) { create(:invoice, client: client1, company:, status: "draft") }
let!(:client1_draft_invoice1) { create(:invoice, client: client1, company:) }

context "when user is an admin" do
before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let!(:client1_sent_invoice2) { create(:invoice, client: client1, status: "sent", due_date: Date.current - 1) }
let!(:client1_sent_invoice3) { create(:invoice, client: client1, status: "sent", due_date: Date.current - 2) }
let(:client1_paid_invoice2) { create(:invoice, client: client1, status: "paid", due_date: Date.current - 1) }
let!(:client1_draft_invoice1) { create(:invoice, client: client1, status: "draft", due_date: Date.current - 1) }
let!(:client1_draft_invoice1) { create(:invoice, client: client1, due_date: Date.current - 1) }
let!(:client1_viewed_invoice1) { create(:invoice, client: client1, status: "viewed", due_date: Date.current + 1) }
let!(:client1_viewed_invoice2) { create(:invoice, client: client1, status: "viewed", due_date: Date.current - 1) }

Expand Down
2 changes: 1 addition & 1 deletion spec/system/invoices/edit_invoice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"

RSpec.describe "Edit Invoice", type: :system do
let!(:invoice) { create :invoice_with_invoice_line_items, status: :draft }
let!(:invoice) { create :invoice_with_invoice_line_items }
let(:client) { invoice.client }
let!(:company) { invoice.company }
let(:admin) { create(:user, current_workspace_id: company.id) }
Expand Down

0 comments on commit 8857b02

Please sign in to comment.