diff options
author | Rémy Coutable <remy@rymai.me> | 2016-08-09 13:14:11 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-08-10 20:07:05 +0300 |
commit | 7c1b33b48f8c45b726a513b6809a85919d41c23c (patch) | |
tree | d983f05024fd856ae9b318e07e1f3e557b82c946 /spec/requests/api/members_spec.rb | |
parent | 29850364eccccc3ce7305f6706cea1d5d073de2e (diff) |
Restore back-compatibility for current members API endpoints
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/requests/api/members_spec.rb')
-rw-r--r-- | spec/requests/api/members_spec.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index b11a16487ac..a56ee30f7b1 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -135,7 +135,7 @@ describe API::Members, api: true do post api("/#{source_type.pluralize}/#{source.id}/members", master), user_id: master.id, access_level: Member::MASTER - expect(response).to have_http_status(409) + expect(response).to have_http_status(source_type == 'project' ? 201 : 409) end it 'returns 400 when user_id is not given' do @@ -152,11 +152,11 @@ describe API::Members, api: true do expect(response).to have_http_status(400) end - it 'returns 400 when access_level is not valid' do + it 'returns 422 when access_level is not valid' do post api("/#{source_type.pluralize}/#{source.id}/members", master), user_id: stranger.id, access_level: 1234 - expect(response).to have_http_status(400) + expect(response).to have_http_status(422) end end end @@ -204,11 +204,11 @@ describe API::Members, api: true do expect(response).to have_http_status(400) end - it 'returns 400 when access level is not valid' do + it 'returns 422 when access level is not valid' do put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master), access_level: 1234 - expect(response).to have_http_status(400) + expect(response).to have_http_status(422) end end end @@ -237,18 +237,18 @@ describe API::Members, api: true do expect do delete api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", developer) - expect(response).to have_http_status(204) + expect(response).to have_http_status(200) end.to change { source.members.count }.by(-1) end end context 'when authenticated as a master/owner' do context 'and member is a requester' do - it 'returns 404' do + it "returns #{source_type == 'project' ? 200 : 404}" do expect do delete api("/#{source_type.pluralize}/#{source.id}/members/#{access_requester.id}", master) - expect(response).to have_http_status(404) + expect(response).to have_http_status(source_type == 'project' ? 200 : 404) end.not_to change { source.requesters.count } end end @@ -257,15 +257,15 @@ describe API::Members, api: true do expect do delete api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master) - expect(response).to have_http_status(204) + expect(response).to have_http_status(200) end.to change { source.members.count }.by(-1) end end - it 'returns 409 if member does not exist' do + it "returns #{source_type == 'project' ? 200 : 404} if member does not exist" do delete api("/#{source_type.pluralize}/#{source.id}/members/123", master) - expect(response).to have_http_status(404) + expect(response).to have_http_status(source_type == 'project' ? 200 : 404) end end end |