From e5efbbd328beb8d333cf437cfb1f1f626fc28730 Mon Sep 17 00:00:00 2001 From: Anna Velentsevich Date: Mon, 22 Jul 2024 16:24:10 +0200 Subject: [PATCH] feat: update error detail relation with integration --- app/models/error_detail.rb | 2 +- spec/factories/invoices.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/error_detail.rb b/app/models/error_detail.rb index 47d682b29f1b..ea1cece6c996 100644 --- a/app/models/error_detail.rb +++ b/app/models/error_detail.rb @@ -4,6 +4,6 @@ class ErrorDetail < ApplicationRecord include Discard::Model self.discard_column = :deleted_at - belongs_to :integration, polymorphic: true + belongs_to :integration, polymorphic: true, optional: true belongs_to :owner, polymorphic: true end diff --git a/spec/factories/invoices.rb b/spec/factories/invoices.rb index ed6f21dd5262..5543d0fa2a6b 100644 --- a/spec/factories/invoices.rb +++ b/spec/factories/invoices.rb @@ -24,8 +24,10 @@ payment_dispute_lost_at { DateTime.current - 1.day } end - trait :with_integration_error do - integration_error_details + trait :with_error do + after :create do |i| + create(:error_detail, owner: i) + end end end end