mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
- Audit log for user invitations: https://linear.app/chatwoot/issue/CW-1768/invited-a-user-to-the-account - Audit log for change role: https://linear.app/chatwoot/issue/CW-1767/name-or-email-changed-the-role-of-the-user-email-to-agent-or-admin - Audit log for status change: https://linear.app/chatwoot/issue/CW-1766/availability-status-as-events-for-audit-logs Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
28 lines
1.0 KiB
Ruby
28 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe AccountUser do
|
|
describe 'audit log' do
|
|
context 'when account user is created' do
|
|
it 'has associated audit log created' do
|
|
account_user = create(:account_user)
|
|
account_user_audit_log = Audited::Audit.where(auditable_type: 'AccountUser', action: 'create').first
|
|
expect(account_user_audit_log).to be_present
|
|
expect(account_user_audit_log.associated).to eq(account_user.account)
|
|
end
|
|
end
|
|
|
|
context 'when account user is updated' do
|
|
it 'has associated audit log created' do
|
|
account_user = create(:account_user)
|
|
account_user.update!(availability: 'offline')
|
|
account_user_audit_log = Audited::Audit.where(auditable_type: 'AccountUser', action: 'update').first
|
|
expect(account_user_audit_log).to be_present
|
|
expect(account_user_audit_log.associated).to eq(account_user.account)
|
|
expect(account_user_audit_log.audited_changes).to eq('availability' => [0, 1])
|
|
end
|
|
end
|
|
end
|
|
end
|