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:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-07-17 17:16:34 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-07-17 17:17:18 +0400
commitaa0473d0eb581a1c4d20be22c53ec4002a3801e0 (patch)
treef023019df0fb50d7047f70c75abd6f956ed697ab /spec/models/key_spec.rb
parent656d800f8c72bc6bb97700b7289a2d5eebc4e42f (diff)
Validate fingerprint uniqueness
Diffstat (limited to 'spec/models/key_spec.rb')
-rw-r--r--spec/models/key_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index fcf2cb9f30d..f4dd726331a 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -42,10 +42,17 @@ describe Key do
build(:key, user: user).should be_valid
end
- it "does not accepts the key twice" do
+ it "does not accept the exact same key twice" do
create(:key, user: user)
build(:key, user: user).should_not be_valid
end
+
+ it "does not accept a duplicate key with a different comment" do
+ create(:key, user: user)
+ duplicate = build(:key, user: user)
+ duplicate.key << ' extra comment'
+ duplicate.should_not be_valid
+ end
end
context "validate it is a fingerprintable key" do