Commit 76bcb1d9 authored by James Lopez's avatar James Lopez

add new changes tests

parent 2d615c30
require 'spec_helper'
describe EE::Audit::Changes do
describe '.audit_changes' do
let(:user) { create(:user) }
let(:foo_class) { Class.new { include EE::Audit::Changes } }
before do
allow_any_instance_of(foo_class).to receive(:model).and_return(user)
end
describe 'non audit changes' do
it 'does not call the audit event service' do
expect_any_instance_of(AuditEventService).not_to receive(:security_event)
user.name = 'new name'
foo_class.new.audit_changes(:email)
end
end
describe 'audit changes' do
it 'calls the audit event service' do
expect_any_instance_of(AuditEventService).to receive(:security_event)
user.name = 'new name'
foo_class.new.audit_changes(:name)
end
end
end
end
......@@ -203,6 +203,7 @@ describe Gitlab::LDAP::Access do
it 'updates email address' do
expect(access).to receive(:update_email).once
expect(AuditEvents.count).to eq(1)
subject
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment