summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 21:09:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 21:09:22 +0000
commit8b5c2a4525819c6b18f422b4baa0f6568286909b (patch)
tree7c59a1e6b4b411c88b53eb046121e9d9b25930df /spec/models
parent5bfb8d1fad825eec90b0af688c7cd1b352c9056e (diff)
downloadgitlab-ce-8b5c2a4525819c6b18f422b4baa0f6568286909b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/service_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index d0673b21329..7c80b5231d1 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -56,6 +56,14 @@ describe Service do
expect(build(:service, :instance)).to be_invalid
end
end
+
+ it 'validates uniqueness of type and project_id on create' do
+ project = create(:project)
+
+ expect(create(:service, project: project, type: 'Service')).to be_valid
+ expect(build(:service, project: project, type: 'Service').valid?(:create)).to eq(false)
+ expect(build(:service, project: project, type: 'Service').valid?(:update)).to eq(true)
+ end
end
describe 'Scopes' do