diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-17 14:03:53 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-17 14:03:53 +0000 |
commit | b98f414a1b8dbadbccceac3a544c15bb456a952b (patch) | |
tree | f023019df0fb50d7047f70c75abd6f956ed697ab /spec | |
parent | dcac37d9e41f21485822647b922ac952bf64358a (diff) | |
parent | aa0473d0eb581a1c4d20be22c53ec4002a3801e0 (diff) | |
download | gitlab-ce-b98f414a1b8dbadbccceac3a544c15bb456a952b.tar.gz |
Merge branch 'key_uniqueness' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/key_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 6c06f5268b3..f4dd726331a 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -42,17 +42,22 @@ 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 - let(:user) { create(:user) } - it "accepts the fingerprintable key" do - build(:key, user: user).should be_valid + build(:key).should be_valid end it "rejects the unfingerprintable key (contains space in middle)" do |