summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-04-13 16:09:17 -0700
committerStan Hu <stanhu@gmail.com>2017-04-13 16:19:25 -0700
commit460fb1fabab8f9afd364055e9d9b212dbb7f8c82 (patch)
tree57880e0b4a557b5762b70cb02bd9627f9ed6dc24 /spec
parent7d7dfee48b3455eec07968e7517f9d843a04da66 (diff)
downloadgitlab-ce-460fb1fabab8f9afd364055e9d9b212dbb7f8c82.tar.gz
Improve error messages when a record is unable to be created for a project
Diffstat (limited to 'spec')
-rw-r--r--spec/services/projects/create_service_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb
index 62f21049b0b..7a07ea618c0 100644
--- a/spec/services/projects/create_service_spec.rb
+++ b/spec/services/projects/create_service_spec.rb
@@ -144,6 +144,20 @@ describe Projects::CreateService, '#execute', services: true do
end
end
+ context 'when a bad service template is created' do
+ before do
+ create(:service, type: 'DroneCiService', project: nil, template: true, active: true)
+ end
+
+ it 'reports an error in the imported project' do
+ opts[:import_url] = 'http://www.gitlab.com/gitlab-org/gitlab-ce'
+ project = create_project(user, opts)
+
+ expect(project.errors.full_messages_for(:base).first).to match /Unable to save project. Error: Unable to save DroneCiService/
+ expect(project.services.count).to eq 0
+ end
+ end
+
def create_project(user, opts)
Projects::CreateService.new(user, opts).execute
end