Files
leadchat/spec/enterprise/models/automation_rule_spec.rb
Vishnu Narayanan d870b0815a feat: Audit log APIs (#6434)
- Adds the appropriate APIs for Audit Logs.

ref: #6015
2023-03-01 20:02:58 +05:30

30 lines
951 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AutomationRule do
let!(:automation_rule) { create(:automation_rule, name: 'automation rule 1') }
describe 'audit log' do
context 'when automation rule is created' do
it 'has associated audit log created' do
expect(Audited::Audit.where(auditable_type: 'AutomationRule', action: 'create').count).to eq 1
end
end
context 'when automation rule is updated' do
it 'has associated audit log created' do
automation_rule.update(name: 'automation rule 2')
expect(Audited::Audit.where(auditable_type: 'AutomationRule', action: 'update').count).to eq 1
end
end
context 'when automation rule is deleted' do
it 'has associated audit log created' do
automation_rule.destroy!
expect(Audited::Audit.where(auditable_type: 'AutomationRule', action: 'destroy').count).to eq 1
end
end
end
end