summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-31 15:43:19 +0200
committerRémy Coutable <remy@rymai.me>2017-06-02 19:06:50 +0200
commit857d039145bccaa81da1e7654e51eee9e4b4823a (patch)
tree5ee5fdc54d98ec7d54fa0f08957dcb7952ff42a4 /spec/models
parent19ee16a0f85dd4bacddbd066237e62a1bbb7113a (diff)
downloadgitlab-ce-857d039145bccaa81da1e7654e51eee9e4b4823a.tar.gz
Lint our factories creation in addition to their build33139-lint-our-factories
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/key_spec.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index 7c40cfd8253..f1e2a2cc518 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -66,14 +66,16 @@ describe Key, models: true do
end
it "does not accept the exact same key twice" do
- create(:key, user: user)
- expect(build(:key, user: user)).not_to be_valid
+ first_key = create(:key, user: user)
+
+ expect(build(:key, user: user, key: first_key.key)).not_to be_valid
end
it "does not accept a duplicate key with a different comment" do
- create(:key, user: user)
- duplicate = build(:key, user: user)
+ first_key = create(:key, user: user)
+ duplicate = build(:key, user: user, key: first_key.key)
duplicate.key << ' extra comment'
+
expect(duplicate).not_to be_valid
end
end