From fc067b7f66e6b09207ff5395f3ce3694b49ddd4a Mon Sep 17 00:00:00 2001 From: Tanmay Sharma Date: Thu, 28 Aug 2025 17:39:01 +0700 Subject: [PATCH] fix capacity test --- spec/enterprise/auto_assignment/capacity_service_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/enterprise/auto_assignment/capacity_service_spec.rb b/spec/enterprise/auto_assignment/capacity_service_spec.rb index ea77b85f1..f0b6ea11b 100644 --- a/spec/enterprise/auto_assignment/capacity_service_spec.rb +++ b/spec/enterprise/auto_assignment/capacity_service_spec.rb @@ -63,8 +63,12 @@ RSpec.describe Enterprise::AutoAssignment::CapacityService, type: :service do describe 'capacity filtering' do it 'excludes agents at capacity' do - available = inbox.available_agents(check_capacity: true) - available_users = available.map(&:user) + # Get available agents respecting capacity + online_agents = inbox.available_agents + filtered_agents = online_agents.select do |inbox_member| + capacity_service.agent_has_capacity?(inbox_member.user, inbox) + end + available_users = filtered_agents.map(&:user) expect(available_users).to include(agent_with_capacity) expect(available_users).to include(agent_without_capacity) # No capacity policy = unlimited