diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-02 18:49:18 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-02 18:49:18 +0000 |
commit | 2662fd721558f916fe621f4eb5cef43e7754beec (patch) | |
tree | fbd06f85ba781801323b1a89870ce48eb8333262 /spec/models | |
parent | 11852e16387790c26be7b8d1dd99ed689bf9d45b (diff) | |
parent | 857d039145bccaa81da1e7654e51eee9e4b4823a (diff) | |
download | gitlab-ce-2662fd721558f916fe621f4eb5cef43e7754beec.tar.gz |
Merge branch '33139-lint-our-factories' into 'master'
Lint our factories creation in addition to their build
Closes #33139
See merge request !11823
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/key_spec.rb | 10 |
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 |