Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-06-27 21:10:42 +0300
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-06-27 21:10:42 +0300
commitabca19da8b0ec12548140f8e771cfc08968d6972 (patch)
tree1db15dba43c2f51a423b8f71a1dbb87e5ea332e2 /spec/requests/api/award_emoji_spec.rb
parente0e325625eb141445720999d4e4a4d60a4b59d95 (diff)
Use HTTP matchers if possible
Diffstat (limited to 'spec/requests/api/award_emoji_spec.rb')
-rw-r--r--spec/requests/api/award_emoji_spec.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/requests/api/award_emoji_spec.rb b/spec/requests/api/award_emoji_spec.rb
index 2e65e7f1920..ed78d582bd0 100644
--- a/spec/requests/api/award_emoji_spec.rb
+++ b/spec/requests/api/award_emoji_spec.rb
@@ -17,7 +17,7 @@ describe API::API, api: true do
it "returns an array of award_emoji" do
get api("/projects/#{project.id}/issues/#{issue.id}/award_emoji", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.first['name']).to eq(award_emoji.name)
end
@@ -25,7 +25,7 @@ describe API::API, api: true do
it "should return a 404 error when issue id not found" do
get api("/projects/#{project.id}/issues/12345/award_emoji", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -33,7 +33,7 @@ describe API::API, api: true do
it "returns an array of award_emoji" do
get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/award_emoji", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.first['name']).to eq(downvote.name)
end
@@ -45,7 +45,7 @@ describe API::API, api: true do
get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/award_emoji", user1)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
end
@@ -56,7 +56,7 @@ describe API::API, api: true do
it 'returns an array of award emoji' do
get api("/projects/#{project.id}/issues/#{issue.id}/notes/#{note.id}/award_emoji", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.first['name']).to eq(rocket.name)
end
@@ -68,7 +68,7 @@ describe API::API, api: true do
it "returns the award emoji" do
get api("/projects/#{project.id}/issues/#{issue.id}/award_emoji/#{award_emoji.id}", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
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")
@@ -77,7 +77,7 @@ describe API::API, api: true do
it "returns a 404 error if the award is not found" do
get api("/projects/#{project.id}/issues/#{issue.id}/award_emoji/12345", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -85,7 +85,7 @@ describe API::API, api: true do
it 'returns the award emoji' do
get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/award_emoji/#{downvote.id}", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
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")
@@ -98,7 +98,7 @@ describe API::API, api: true do
get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/award_emoji/#{downvote.id}", user1)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
end
@@ -109,7 +109,7 @@ describe API::API, api: true do
it 'returns an award emoji' do
get api("/projects/#{project.id}/issues/#{issue.id}/notes/#{note.id}/award_emoji/#{rocket.id}", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response).not_to be_an Array
expect(json_response['name']).to eq(rocket.name)
end
@@ -120,7 +120,7 @@ describe API::API, api: true do
it "creates a new award emoji" do
post api("/projects/#{project.id}/issues/#{issue.id}/award_emoji", user), name: 'blowfish'
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['name']).to eq('blowfish')
expect(json_response['user']['username']).to eq(user.username)
end
@@ -128,13 +128,13 @@ describe API::API, api: true do
it "should return a 400 bad request error if the name is not given" do
post api("/projects/#{project.id}/issues/#{issue.id}/award_emoji", user)
- expect(response.status).to eq(400)
+ expect(response).to have_http_status(400)
end
it "should return a 401 unauthorized error if the user is not authenticated" do
post api("/projects/#{project.id}/issues/#{issue.id}/award_emoji"), name: 'thumbsup'
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end
@@ -145,7 +145,7 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues/#{issue.id}/notes/#{note.id}/award_emoji", user), name: 'rocket'
end.to change { note.award_emoji.count }.from(0).to(1)
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['user']['username']).to eq(user.username)
end
end
@@ -157,13 +157,13 @@ describe API::API, api: true do
delete api("/projects/#{project.id}/issues/#{issue.id}/award_emoji/#{award_emoji.id}", user)
end.to change { issue.award_emoji.count }.from(1).to(0)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
end
it 'returns a 404 error when the award emoji can not be found' do
delete api("/projects/#{project.id}/issues/#{issue.id}/award_emoji/12345", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -173,13 +173,13 @@ describe API::API, api: true do
delete api("/projects/#{project.id}/merge_requests/#{merge_request.id}/award_emoji/#{downvote.id}", user)
end.to change { merge_request.award_emoji.count }.from(1).to(0)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
end
it 'returns a 404 error when note id not found' do
delete api("/projects/#{project.id}/merge_requests/#{merge_request.id}/notes/12345", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
end
@@ -192,7 +192,7 @@ describe API::API, api: true do
delete api("/projects/#{project.id}/issues/#{issue.id}/notes/#{note.id}/award_emoji/#{rocket.id}", user)
end.to change { note.award_emoji.count }.from(1).to(0)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
end
end
end