diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-02-24 03:18:14 +0000 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-03-07 17:50:11 +0000 |
commit | ef15668d8214e8cce5732525c872d5b8f57e337a (patch) | |
tree | b76633818d52f91567971a45d34a4a7b84e91142 /spec/controllers | |
parent | 6253d4456a98613b419d766a03af7ff9b9fcf2af (diff) | |
download | gitlab-ce-ef15668d8214e8cce5732525c872d5b8f57e337a.tar.gz |
Service integration displays validation errors on test fail
Fixes attempts to update a service integration which had `can_test?`
set to true but validations were causing the "Test and save changes"
button to return "Something went wrong on our end."
Removes references to index action left from 0af99433143727088b6a0a1b2163751c05d80ce6
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/services_controller_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index 847ac6f2be0..e4dc61b3a68 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -23,6 +23,18 @@ describe Projects::ServicesController do end end + context 'when validations fail' do + let(:service_params) { { active: 'true', token: '' } } + + it 'returns error messages in JSON response' do + put :test, namespace_id: project.namespace, project_id: project, id: :hipchat, service: service_params + + expect(json_response['message']).to eq "Validations failed." + expect(json_response['service_response']).to eq "Token can't be blank" + expect(response).to have_gitlab_http_status(200) + end + end + context 'success' do context 'with empty project' do let(:project) { create(:project) } |