diff options
author | Vincent Wong <wingyu64@gmail.com> | 2016-12-22 01:59:54 +1100 |
---|---|---|
committer | Vincent Wong <wingyu64@gmail.com> | 2017-01-09 04:15:39 +1100 |
commit | b6df93a51f90c7ed29ce6667c6b1a8debf02506e (patch) | |
tree | ff13ffc730ceeb52635bad3204db1050d0e74947 /spec/models/key_spec.rb | |
parent | f264ec6ee74a0263b4e5212e921c4638c25f8fcd (diff) | |
download | gitlab-ce-b6df93a51f90c7ed29ce6667c6b1a8debf02506e.tar.gz |
Record and show last used date of SSH Keys
Addresses: Issue #13810
1. Adds a last_used_at attribute to the Key table/model
2. Update a key's last_used_at whenever it gets used
3. Display how long ago an ssh key was last used
Diffstat (limited to 'spec/models/key_spec.rb')
-rw-r--r-- | spec/models/key_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 7758b7ffa97..5eaddd822be 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -28,6 +28,15 @@ describe Key, models: true do expect(build(:key, user: user).publishable_key).to include("#{user.name} (#{Gitlab.config.gitlab.host})") end end + + describe "#update_last_used_at" do + it "enqueues a UseKeyWorker job" do + key = create(:key) + + expect(UseKeyWorker).to receive(:perform_async).with(key.id) + key.update_last_used_at + end + end end context "validation of uniqueness (based on fingerprint uniqueness)" do |