Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,29 @@
require 'rails_helper'
RSpec.describe AgentCapacityPolicy, type: :model do
let(:account) { create(:account) }
describe 'validations' do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_length_of(:name).is_at_most(255) }
end
describe 'destruction' do
let(:policy) { create(:agent_capacity_policy, account: account) }
let(:user) { create(:user, account: account) }
let(:inbox) { create(:inbox, account: account) }
it 'destroys associated inbox capacity limits' do
create(:inbox_capacity_limit, agent_capacity_policy: policy, inbox: inbox)
expect { policy.destroy }.to change(InboxCapacityLimit, :count).by(-1)
end
it 'nullifies associated account users' do
account_user = user.account_users.first
account_user.update!(agent_capacity_policy: policy)
policy.destroy
expect(account_user.reload.agent_capacity_policy).to be_nil
end
end
end