Commit c180f007 authored by James Lopez's avatar James Lopez

added ssh key event and spec

parent 16abde42
...@@ -28,6 +28,8 @@ class Key < ActiveRecord::Base ...@@ -28,6 +28,8 @@ class Key < ActiveRecord::Base
delegate :name, :email, to: :user, prefix: true delegate :name, :email, to: :user, prefix: true
alias_attribute :full_path, :title
after_commit :add_to_shell, on: :create after_commit :add_to_shell, on: :create
after_create :post_create_hook after_create :post_create_hook
after_commit :remove_from_shell, on: :destroy after_commit :remove_from_shell, on: :destroy
......
...@@ -66,4 +66,14 @@ describe Profiles::KeysController do ...@@ -66,4 +66,14 @@ describe Profiles::KeysController do
end end
end end
end end
describe '#create' do
it 'logs the audit event' do
sign_in(user)
key = build(:key)
expect { post :create, key: key.attributes }.to change{ SecurityEvent.count }.by(1)
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