Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Wong <wingyu64@gmail.com>2016-12-21 17:59:54 +0300
committerVincent Wong <wingyu64@gmail.com>2017-01-08 20:15:39 +0300
commitb6df93a51f90c7ed29ce6667c6b1a8debf02506e (patch)
treeff13ffc730ceeb52635bad3204db1050d0e74947 /spec/models/key_spec.rb
parentf264ec6ee74a0263b4e5212e921c4638c25f8fcd (diff)
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.rb9
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