Commit 77baf398 authored by Rajendra Kadam's avatar Rajendra Kadam

Add spec for checking Security event and fix specs

parent 161a5248
...@@ -3,14 +3,18 @@ ...@@ -3,14 +3,18 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Keys::CreateService do RSpec.describe Keys::CreateService do
let(:admin_user) { create(:admin)}
let(:user) { create(:user) } let(:user) { create(:user) }
let(:params) { attributes_for(:key) } let(:params) { attributes_for(:key).merge(user: user) }
subject { described_class.new(user, params) } subject { described_class.new(admin_user, params) }
it 'creates' do it 'creates' do
stub_licensed_features(extended_audit_events: true) stub_licensed_features(extended_audit_events: true)
expect { subject.execute }.to change { SecurityEvent.count }.by(1) expect { subject.execute }.to change { SecurityEvent.count }.by(1)
event = SecurityEvent.last
expect(event.author_name).to eq(admin_user.name)
expect(event.entity_id).to eq(user.id)
end end
end 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