summaryrefslogtreecommitdiff
path: root/spec/requests/api/services_spec.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-11-18 11:38:54 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-11-18 11:38:54 +0100
commitf749fb7fe0574d07eeb38561b9af62754e518281 (patch)
treee8647693e60b73f12cd3b9dca0efb0aec1796fcb /spec/requests/api/services_spec.rb
parentb8607576c1bb25fe2cbb575b48becdf7bd4aaa8c (diff)
downloadgitlab-ce-f749fb7fe0574d07eeb38561b9af62754e518281.tar.gz
Improve style, add more tests
Diffstat (limited to 'spec/requests/api/services_spec.rb')
-rw-r--r--spec/requests/api/services_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb
index fb234ab8ed1..765d662e52b 100644
--- a/spec/requests/api/services_spec.rb
+++ b/spec/requests/api/services_spec.rb
@@ -102,6 +102,8 @@ describe API::API, api: true do
end
context 'the service exists' do
+ let(:params) { { token: 'token' } }
+
context 'the service is not active' do
let!(:inactive_service) do
project.create_mattermost_command_service(
@@ -124,7 +126,6 @@ describe API::API, api: true do
properties: { token: 'token' }
)
end
- let(:params) { { token: 'token' } }
it 'retusn status 200' do
post api("/projects/#{project.id}/services/mattermost_command/trigger"), params
@@ -132,6 +133,15 @@ describe API::API, api: true do
expect(response).to have_http_status(200)
end
end
+
+ context 'when the project can not be found' do
+ it 'returns a generic 404' do
+ post api("/projects/404/services/mattermost_command/trigger"), params
+
+ expect(response).to have_http_status(404)
+ expect(json_response["message"]).to eq '404 Not Found'
+ end
+ end
end
end
end