diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-21 15:09:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-21 15:09:07 +0300 |
commit | 2a040e2655fe0a99df61ad0a7bd0c27e68af0c38 (patch) | |
tree | a245cd0d6dd10f185e2fd098e371adc1ea03b72b /spec/requests/api/award_emoji_spec.rb | |
parent | a53d2c37c4934f564caa94543dd4cf5af1703e2d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/award_emoji_spec.rb')
-rw-r--r-- | spec/requests/api/award_emoji_spec.rb | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/spec/requests/api/award_emoji_spec.rb b/spec/requests/api/award_emoji_spec.rb index 4a830f2b449..fea1e3ac836 100644 --- a/spec/requests/api/award_emoji_spec.rb +++ b/spec/requests/api/award_emoji_spec.rb @@ -20,7 +20,7 @@ describe API::AwardEmoji do it "returns an array of award_emoji" do get api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Array expect(json_response.first['name']).to eq(award_emoji.name) end @@ -28,7 +28,7 @@ describe API::AwardEmoji do it "returns a 404 error when issue id not found" do get api("/projects/#{project.id}/issues/12345/award_emoji", user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -36,7 +36,7 @@ describe API::AwardEmoji do it "returns an array of award_emoji" do get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/award_emoji", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.first['name']).to eq(downvote.name) @@ -50,7 +50,7 @@ describe API::AwardEmoji do it 'returns the awarded emoji' do get api("/projects/#{project.id}/snippets/#{snippet.id}/award_emoji", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Array expect(json_response.first['name']).to eq(award.name) end @@ -62,7 +62,7 @@ describe API::AwardEmoji do get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/award_emoji", user1) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -73,7 +73,7 @@ describe API::AwardEmoji do it 'returns an array of award emoji' do get api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Array expect(json_response.first['name']).to eq(rocket.name) end @@ -84,7 +84,7 @@ describe API::AwardEmoji do it "returns the award emoji" do get api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji/#{award_emoji.id}", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response['name']).to eq(award_emoji.name) expect(json_response['awardable_id']).to eq(issue.id) expect(json_response['awardable_type']).to eq("Issue") @@ -93,7 +93,7 @@ describe API::AwardEmoji do it "returns a 404 error if the award is not found" do get api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji/12345", user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -101,7 +101,7 @@ describe API::AwardEmoji do it 'returns the award emoji' do get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/award_emoji/#{downvote.id}", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response['name']).to eq(downvote.name) expect(json_response['awardable_id']).to eq(merge_request.id) expect(json_response['awardable_type']).to eq("MergeRequest") @@ -115,7 +115,7 @@ describe API::AwardEmoji do it 'returns the awarded emoji' do get api("/projects/#{project.id}/snippets/#{snippet.id}/award_emoji/#{award.id}", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response['name']).to eq(award.name) expect(json_response['awardable_id']).to eq(snippet.id) expect(json_response['awardable_type']).to eq("Snippet") @@ -128,7 +128,7 @@ describe API::AwardEmoji do get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/award_emoji/#{downvote.id}", user1) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -139,7 +139,7 @@ describe API::AwardEmoji do it 'returns an award emoji' do get api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji/#{rocket.id}", user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).not_to be_an Array expect(json_response['name']).to eq(rocket.name) end @@ -152,7 +152,7 @@ describe API::AwardEmoji do it "creates a new award emoji" do post api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji", user), params: { name: 'blowfish' } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq('blowfish') expect(json_response['user']['username']).to eq(user.username) end @@ -168,13 +168,13 @@ describe API::AwardEmoji do it "returns a 400 bad request error if the name is not given" do post api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji", user) - expect(response).to have_gitlab_http_status(400) + expect(response).to have_gitlab_http_status(:bad_request) end it "returns a 401 unauthorized error if the user is not authenticated" do post api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji"), params: { name: 'thumbsup' } - expect(response).to have_gitlab_http_status(401) + expect(response).to have_gitlab_http_status(:unauthorized) end it "normalizes +1 as thumbsup award" do @@ -188,7 +188,7 @@ describe API::AwardEmoji do post api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji", user), params: { name: 'thumbsup' } post api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji", user), params: { name: 'thumbsup' } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) expect(json_response["message"]).to match("has already been taken") end end @@ -200,7 +200,7 @@ describe API::AwardEmoji do post api("/projects/#{project.id}/snippets/#{snippet.id}/award_emoji", user), params: { name: 'blowfish' } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq('blowfish') expect(json_response['user']['username']).to eq(user.username) end @@ -215,7 +215,7 @@ describe API::AwardEmoji do post api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji", user), params: { name: 'rocket' } end.to change { note.award_emoji.count }.from(0).to(1) - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['user']['username']).to eq(user.username) end @@ -238,7 +238,7 @@ describe API::AwardEmoji do post api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji", user), params: { name: 'rocket' } post api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji", user), params: { name: 'rocket' } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) expect(json_response["message"]).to match("has already been taken") end end @@ -250,14 +250,14 @@ describe API::AwardEmoji do expect do delete api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji/#{award_emoji.id}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end.to change { issue.award_emoji.count }.from(1).to(0) end it 'returns a 404 error when the award emoji can not be found' do delete api("/projects/#{project.id}/issues/#{issue.iid}/award_emoji/12345", user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it_behaves_like '412 response' do @@ -270,14 +270,14 @@ describe API::AwardEmoji do expect do delete api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/award_emoji/#{downvote.id}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end.to change { merge_request.award_emoji.count }.from(1).to(0) end it 'returns a 404 error when note id not found' do delete api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/notes/12345", user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it_behaves_like '412 response' do @@ -293,7 +293,7 @@ describe API::AwardEmoji do expect do delete api("/projects/#{project.id}/snippets/#{snippet.id}/award_emoji/#{award.id}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end.to change { snippet.award_emoji.count }.from(1).to(0) end @@ -310,7 +310,7 @@ describe API::AwardEmoji do expect do delete api("/projects/#{project.id}/issues/#{issue.iid}/notes/#{note.id}/award_emoji/#{rocket.id}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end.to change { note.award_emoji.count }.from(1).to(0) end |