diff options
Diffstat (limited to 'spec/requests/api/v3/project_hooks_spec.rb')
-rw-r--r-- | spec/requests/api/v3/project_hooks_spec.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/requests/api/v3/project_hooks_spec.rb b/spec/requests/api/v3/project_hooks_spec.rb index b0eddbb5dd2..00f59744a31 100644 --- a/spec/requests/api/v3/project_hooks_spec.rb +++ b/spec/requests/api/v3/project_hooks_spec.rb @@ -22,7 +22,7 @@ describe API::ProjectHooks, 'ProjectHooks' do it "returns project hooks" do get v3_api("/projects/#{project.id}/hooks", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(json_response.count).to eq(1) expect(json_response.first['url']).to eq("http://example.com") @@ -42,7 +42,7 @@ describe API::ProjectHooks, 'ProjectHooks' do it "does not access project hooks" do get v3_api("/projects/#{project.id}/hooks", user3) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -51,7 +51,7 @@ describe API::ProjectHooks, 'ProjectHooks' do context "authorized user" do it "returns a project hook" do get v3_api("/projects/#{project.id}/hooks/#{hook.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['url']).to eq(hook.url) expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['push_events']).to eq(hook.push_events) @@ -66,20 +66,20 @@ describe API::ProjectHooks, 'ProjectHooks' do it "returns a 404 error if hook id is not available" do get v3_api("/projects/#{project.id}/hooks/1234", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end context "unauthorized user" do it "does not access an existing hook" do get v3_api("/projects/#{project.id}/hooks/#{hook.id}", user3) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end it "returns a 404 error if hook id is not available" do get v3_api("/projects/#{project.id}/hooks/1234", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -90,7 +90,7 @@ describe API::ProjectHooks, 'ProjectHooks' do url: "http://example.com", issues_events: true, wiki_page_events: true, build_events: true end.to change {project.hooks.count}.by(1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['url']).to eq('http://example.com') expect(json_response['issues_events']).to eq(true) expect(json_response['push_events']).to eq(true) @@ -111,7 +111,7 @@ describe API::ProjectHooks, 'ProjectHooks' do post v3_api("/projects/#{project.id}/hooks", user), url: "http://example.com", token: token end.to change {project.hooks.count}.by(1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["url"]).to eq("http://example.com") expect(json_response).not_to include("token") @@ -123,12 +123,12 @@ describe API::ProjectHooks, 'ProjectHooks' do it "returns a 400 error if url not given" do post v3_api("/projects/#{project.id}/hooks", user) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it "returns a 422 error if url not valid" do post v3_api("/projects/#{project.id}/hooks", user), "url" => "ftp://example.com" - expect(response).to have_http_status(422) + expect(response).to have_gitlab_http_status(422) end end @@ -136,7 +136,7 @@ describe API::ProjectHooks, 'ProjectHooks' do it "updates an existing project hook" do put v3_api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'http://example.org', push_events: false, build_events: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['url']).to eq('http://example.org') expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['push_events']).to eq(false) @@ -154,7 +154,7 @@ describe API::ProjectHooks, 'ProjectHooks' do put v3_api("/projects/#{project.id}/hooks/#{hook.id}", user), url: "http://example.org", token: token - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response["url"]).to eq("http://example.org") expect(json_response).not_to include("token") @@ -164,17 +164,17 @@ describe API::ProjectHooks, 'ProjectHooks' do it "returns 404 error if hook id not found" do put v3_api("/projects/#{project.id}/hooks/1234", user), url: 'http://example.org' - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns 400 error if url is not given" do put v3_api("/projects/#{project.id}/hooks/#{hook.id}", user) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it "returns a 422 error if url is not valid" do put v3_api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'ftp://example.com' - expect(response).to have_http_status(422) + expect(response).to have_gitlab_http_status(422) end end @@ -183,23 +183,23 @@ describe API::ProjectHooks, 'ProjectHooks' do expect do delete v3_api("/projects/#{project.id}/hooks/#{hook.id}", user) end.to change {project.hooks.count}.by(-1) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end it "returns success when deleting hook" do delete v3_api("/projects/#{project.id}/hooks/#{hook.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end it "returns a 404 error when deleting non existent hook" do delete v3_api("/projects/#{project.id}/hooks/42", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns a 404 error if hook id not given" do delete v3_api("/projects/#{project.id}/hooks", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns a 404 if a user attempts to delete project hooks he/she does not own" do @@ -208,7 +208,7 @@ describe API::ProjectHooks, 'ProjectHooks' do other_project.team << [test_user, :master] delete v3_api("/projects/#{other_project.id}/hooks/#{hook.id}", test_user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(WebHook.exists?(hook.id)).to be_truthy end end |