From f3319c8a36940d65c26d21fc87fa05483b2f374c Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Mon, 8 Jun 2026 15:15:25 +0200 Subject: [PATCH] Fix specs after adding the principal_explicit flag --- .../models/resource_allocation_acts_as_journalized_spec.rb | 2 +- .../spec/models/resource_allocation_spec.rb | 2 ++ .../spec/services/principals/delete_job_integration_spec.rb | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/resource_management/spec/models/resource_allocation_acts_as_journalized_spec.rb b/modules/resource_management/spec/models/resource_allocation_acts_as_journalized_spec.rb index 4ed0b4f6cf2..80156abaac1 100644 --- a/modules/resource_management/spec/models/resource_allocation_acts_as_journalized_spec.rb +++ b/modules/resource_management/spec/models/resource_allocation_acts_as_journalized_spec.rb @@ -80,7 +80,7 @@ RSpec.describe ResourceAllocation do end it "tracks filter_name changes" do - allocation.update!(filter_name: "Full stack Developer (DE-EN)") + allocation.update!(principal_explicit: false, filter_name: "Full stack Developer (DE-EN)") expect(allocation.last_journal.data.filter_name).to eq("Full stack Developer (DE-EN)") expect(allocation.last_journal.details).to include("filter_name" => [nil, "Full stack Developer (DE-EN)"]) diff --git a/modules/resource_management/spec/models/resource_allocation_spec.rb b/modules/resource_management/spec/models/resource_allocation_spec.rb index 251bf276bb8..ddb35f11a02 100644 --- a/modules/resource_management/spec/models/resource_allocation_spec.rb +++ b/modules/resource_management/spec/models/resource_allocation_spec.rb @@ -32,6 +32,8 @@ require "spec_helper" RSpec.describe ResourceAllocation do describe "associations" do + subject { described_class.new(principal_explicit: false) } + it { is_expected.to belong_to(:entity).required } it { is_expected.to belong_to(:principal).class_name("User").inverse_of(:resource_allocations).optional } it { is_expected.to belong_to(:requested_by).class_name("User").optional } diff --git a/modules/resource_management/spec/services/principals/delete_job_integration_spec.rb b/modules/resource_management/spec/services/principals/delete_job_integration_spec.rb index 67e5921fbfa..238db68e719 100644 --- a/modules/resource_management/spec/services/principals/delete_job_integration_spec.rb +++ b/modules/resource_management/spec/services/principals/delete_job_integration_spec.rb @@ -39,7 +39,9 @@ RSpec.describe Principals::DeleteJob, "ResourceAllocation", type: :model do context "with a resource allocation assigned to the principal" do let!(:allocation) { create(:resource_allocation, principal:) } let!(:other_allocation) { create(:resource_allocation, principal: create(:user)) } - let!(:unassigned_allocation) { create(:resource_allocation, principal: nil) } + let!(:unassigned_allocation) do + create(:resource_allocation, principal: nil, principal_explicit: false, filter_name: "Devs") + end it "rewrites the principal to the deleted user placeholder" do job