From 8443e2bd44249cb85b251753791e5df62195c946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20J=C3=A4ggi?= Date: Wed, 21 Aug 2024 17:36:40 +0200 Subject: [PATCH] fix various spec --- app/domain/invoices/abacus/sales_order.rb | 2 +- spec/abilities/json_api/external_invoice_ability_spec.rb | 4 ++++ spec/abilities/token_ability_spec.rb | 4 ++++ spec/resources/external_invoice/reads_spec.rb | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/domain/invoices/abacus/sales_order.rb b/app/domain/invoices/abacus/sales_order.rb index 910963657..40b82c99d 100644 --- a/app/domain/invoices/abacus/sales_order.rb +++ b/app/domain/invoices/abacus/sales_order.rb @@ -53,7 +53,7 @@ def full_attrs def sales_order_attrs { # customer id is defined to be the same as subject id - customer_id: entity.person.reload.abacus_subject_key, + customer_id: entity.person.abacus_subject_key, order_date: entity.issued_at, delivery_date: entity.sent_at, total_amount: entity.total.to_f, diff --git a/spec/abilities/json_api/external_invoice_ability_spec.rb b/spec/abilities/json_api/external_invoice_ability_spec.rb index 9bd558728..fbd4320e6 100644 --- a/spec/abilities/json_api/external_invoice_ability_spec.rb +++ b/spec/abilities/json_api/external_invoice_ability_spec.rb @@ -19,6 +19,10 @@ group: groups(:bluemlisalp_funktionaere)).person end + before do + external_invoices(:external_invoice_draft).destroy! + end + context "index" do def accessible_by(user) ExternalInvoice.accessible_by(described_class.new(user)) diff --git a/spec/abilities/token_ability_spec.rb b/spec/abilities/token_ability_spec.rb index 3ac082210..0ab4b3c0c 100644 --- a/spec/abilities/token_ability_spec.rb +++ b/spec/abilities/token_ability_spec.rb @@ -15,6 +15,10 @@ let(:ability) { TokenAbility.new(token) } + before do + external_invoices(:external_invoice_draft).destroy! + end + describe "index_external_invoices on Group" do context :root do let(:token) { service_tokens(:permitted_root_layer_token) } diff --git a/spec/resources/external_invoice/reads_spec.rb b/spec/resources/external_invoice/reads_spec.rb index 91ddf3f57..dd059efc0 100644 --- a/spec/resources/external_invoice/reads_spec.rb +++ b/spec/resources/external_invoice/reads_spec.rb @@ -30,6 +30,10 @@ ] end + before do + external_invoices(:external_invoice_draft).destroy! + end + it "serializes expected attributes" do render data = jsonapi_data[0]