diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-11-18 13:38:54 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-11-18 13:38:54 +0300 |
commit | f749fb7fe0574d07eeb38561b9af62754e518281 (patch) | |
tree | e8647693e60b73f12cd3b9dca0efb0aec1796fcb /spec/requests | |
parent | b8607576c1bb25fe2cbb575b48becdf7bd4aaa8c (diff) |
Improve style, add more tests
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/services_spec.rb | 12 |
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 |