fix test cases

This commit is contained in:
Tanmay Deep Sharma
2025-08-01 01:47:47 +05:30
parent 5f03418ac9
commit 3af6e6c493
12 changed files with 139 additions and 26 deletions
@@ -4,6 +4,24 @@ require 'rails_helper'
shared_examples_for 'auto_assignment_handler' do
describe '#auto assignment' do
before do
# Stub GlobalConfig for assignment_v2 feature flag before any objects are created
allow(GlobalConfig).to receive(:get) do |key, default = nil|
case key
when 'assignment_v2'
nil
when 'assignment_v2_disabled'
false
when 'assignment_v2_disabled_inboxes'
[]
else
default
end
end
create(:inbox_member, inbox: inbox, user: agent)
allow(Redis::Alfred).to receive(:rpoplpush).and_return(agent.id)
end
let(:account) { create(:account) }
let(:agent) { create(:user, email: 'agent1@example.com', account: account, auto_offline: false) }
let(:inbox) { create(:inbox, account: account) }
@@ -17,11 +35,6 @@ shared_examples_for 'auto_assignment_handler' do
)
end
before do
create(:inbox_member, inbox: inbox, user: agent)
allow(Redis::Alfred).to receive(:rpoplpush).and_return(agent.id)
end
it 'runs round robin on after_save callbacks' do
expect(conversation.reload.assignee).to eq(agent)
end