diff options
Diffstat (limited to 'spec/requests/api/labels_spec.rb')
-rw-r--r-- | spec/requests/api/labels_spec.rb | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb index b231fdea2a3..3498e5bc8d9 100644 --- a/spec/requests/api/labels_spec.rb +++ b/spec/requests/api/labels_spec.rb @@ -27,7 +27,7 @@ describe API::Labels do get api("/projects/#{project.id}/labels", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.size).to eq(3) @@ -75,7 +75,7 @@ describe API::Labels do description: 'test', priority: 2 - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq('Foo') expect(json_response['color']).to eq('#FFAABB') expect(json_response['description']).to eq('test') @@ -109,19 +109,19 @@ describe API::Labels do it 'returns a 400 bad request if name not given' do post api("/projects/#{project.id}/labels", user), color: '#FFAABB' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it 'returns a 400 bad request if color not given' do post api("/projects/#{project.id}/labels", user), name: 'Foobar' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it 'returns 400 for invalid color' do post api("/projects/#{project.id}/labels", user), name: 'Foo', color: '#FFAA' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['color']).to eq(['must be a valid color code']) end @@ -129,7 +129,7 @@ describe API::Labels do post api("/projects/#{project.id}/labels", user), name: 'Foo', color: '#FFAAFFFF' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['color']).to eq(['must be a valid color code']) end @@ -137,7 +137,7 @@ describe API::Labels do post api("/projects/#{project.id}/labels", user), name: ',', color: '#FFAABB' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['title']).to eq(['is invalid']) end @@ -150,7 +150,7 @@ describe API::Labels do name: group_label.name, color: '#FFAABB' - expect(response).to have_http_status(409) + expect(response).to have_gitlab_http_status(409) expect(json_response['message']).to eq('Label already exists') end @@ -160,14 +160,14 @@ describe API::Labels do color: '#FFAAFFFF', priority: 'foo' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it 'returns 409 if label already exists in project' do post api("/projects/#{project.id}/labels", user), name: 'label1', color: '#FFAABB' - expect(response).to have_http_status(409) + expect(response).to have_gitlab_http_status(409) expect(json_response['message']).to eq('Label already exists') end end @@ -176,18 +176,18 @@ describe API::Labels do it 'returns 204 for existing label' do delete api("/projects/#{project.id}/labels", user), name: 'label1' - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end it 'returns 404 for non existing label' do delete api("/projects/#{project.id}/labels", user), name: 'label2' - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Label Not Found') end it 'returns 400 for wrong parameters' do delete api("/projects/#{project.id}/labels", user) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it_behaves_like '412 response' do @@ -203,7 +203,7 @@ describe API::Labels do new_name: 'New Label', color: '#FFFFFF', description: 'test' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq('New Label') expect(json_response['color']).to eq('#FFFFFF') expect(json_response['description']).to eq('test') @@ -213,7 +213,7 @@ describe API::Labels do put api("/projects/#{project.id}/labels", user), name: 'label1', new_name: 'New Label' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq('New Label') expect(json_response['color']).to eq(label1.color) end @@ -222,7 +222,7 @@ describe API::Labels do put api("/projects/#{project.id}/labels", user), name: 'label1', color: '#FFFFFF' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(label1.name) expect(json_response['color']).to eq('#FFFFFF') end @@ -232,7 +232,7 @@ describe API::Labels do name: 'bug', description: 'test' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(priority_label.name) expect(json_response['description']).to eq('test') expect(json_response['priority']).to eq(3) @@ -272,18 +272,18 @@ describe API::Labels do put api("/projects/#{project.id}/labels", user), name: 'label2', new_name: 'label3' - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'returns 400 if no label name given' do put api("/projects/#{project.id}/labels", user), new_name: 'label2' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('name is missing') end it 'returns 400 if no new parameters given' do put api("/projects/#{project.id}/labels", user), name: 'label1' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('new_name, color, description, priority are missing, '\ 'at least one parameter must be provided') end @@ -293,7 +293,7 @@ describe API::Labels do name: 'label1', new_name: ',', color: '#FFFFFF' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['title']).to eq(['is invalid']) end @@ -301,7 +301,7 @@ describe API::Labels do put api("/projects/#{project.id}/labels", user), name: 'label1', color: '#FF' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['color']).to eq(['must be a valid color code']) end @@ -309,7 +309,7 @@ describe API::Labels do post api("/projects/#{project.id}/labels", user), name: 'Foo', color: '#FFAAFFFF' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['color']).to eq(['must be a valid color code']) end @@ -318,7 +318,7 @@ describe API::Labels do name: 'Foo', priority: 'foo' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end @@ -327,7 +327,7 @@ describe API::Labels do it "subscribes to the label" do post api("/projects/#{project.id}/labels/#{label1.title}/subscribe", user) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["name"]).to eq(label1.title) expect(json_response["subscribed"]).to be_truthy end @@ -337,7 +337,7 @@ describe API::Labels do it "subscribes to the label" do post api("/projects/#{project.id}/labels/#{label1.id}/subscribe", user) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["name"]).to eq(label1.title) expect(json_response["subscribed"]).to be_truthy end @@ -351,7 +351,7 @@ describe API::Labels do it "returns 304" do post api("/projects/#{project.id}/labels/#{label1.id}/subscribe", user) - expect(response).to have_http_status(304) + expect(response).to have_gitlab_http_status(304) end end @@ -359,7 +359,7 @@ describe API::Labels do it "returns 404 error" do post api("/projects/#{project.id}/labels/1234/subscribe", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -373,7 +373,7 @@ describe API::Labels do it "unsubscribes from the label" do post api("/projects/#{project.id}/labels/#{label1.title}/unsubscribe", user) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["name"]).to eq(label1.title) expect(json_response["subscribed"]).to be_falsey end @@ -383,7 +383,7 @@ describe API::Labels do it "unsubscribes from the label" do post api("/projects/#{project.id}/labels/#{label1.id}/unsubscribe", user) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["name"]).to eq(label1.title) expect(json_response["subscribed"]).to be_falsey end @@ -397,7 +397,7 @@ describe API::Labels do it "returns 304" do post api("/projects/#{project.id}/labels/#{label1.id}/unsubscribe", user) - expect(response).to have_http_status(304) + expect(response).to have_gitlab_http_status(304) end end @@ -405,7 +405,7 @@ describe API::Labels do it "returns 404 error" do post api("/projects/#{project.id}/labels/1234/unsubscribe", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end |