30 lines
951 B
Ruby
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
|