diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-01 16:00:44 +0100 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-09 15:11:39 +0100 |
commit | 1d268a89deef10854193db48d65cf5d519a0363d (patch) | |
tree | 59765b4a2f83b453875fa7aefe9b7ab5c65e3c67 /spec/requests/api/project_hooks_spec.rb | |
parent | 519275c1102ad8a1d56f5807de2d8a1ae4b21dc0 (diff) | |
download | gitlab-ce-1d268a89deef10854193db48d65cf5d519a0363d.tar.gz |
adds second batch of tests changed to active tenseactive-tense-test-coverage
Diffstat (limited to 'spec/requests/api/project_hooks_spec.rb')
-rw-r--r-- | spec/requests/api/project_hooks_spec.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/requests/api/project_hooks_spec.rb b/spec/requests/api/project_hooks_spec.rb index fd1fffa6223..34fac297923 100644 --- a/spec/requests/api/project_hooks_spec.rb +++ b/spec/requests/api/project_hooks_spec.rb @@ -20,7 +20,7 @@ describe API::API, 'ProjectHooks', api: true do describe "GET /projects/:id/hooks" do context "authorized user" do - it "should return project hooks" do + it "returns project hooks" do get api("/projects/#{project.id}/hooks", user) expect(response).to have_http_status(200) @@ -38,7 +38,7 @@ describe API::API, 'ProjectHooks', api: true do end context "unauthorized user" do - it "should not access project hooks" do + it "does not access project hooks" do get api("/projects/#{project.id}/hooks", user3) expect(response).to have_http_status(403) end @@ -47,7 +47,7 @@ describe API::API, 'ProjectHooks', api: true do describe "GET /projects/:id/hooks/:hook_id" do context "authorized user" do - it "should return a project hook" do + it "returns a project hook" do get api("/projects/#{project.id}/hooks/#{hook.id}", user) expect(response).to have_http_status(200) expect(json_response['url']).to eq(hook.url) @@ -59,27 +59,27 @@ describe API::API, 'ProjectHooks', api: true do expect(json_response['enable_ssl_verification']).to eq(hook.enable_ssl_verification) end - it "should return a 404 error if hook id is not available" do + it "returns a 404 error if hook id is not available" do get api("/projects/#{project.id}/hooks/1234", user) expect(response).to have_http_status(404) end end context "unauthorized user" do - it "should not access an existing hook" do + it "does not access an existing hook" do get api("/projects/#{project.id}/hooks/#{hook.id}", user3) expect(response).to have_http_status(403) end end - it "should return a 404 error if hook id is not available" do + it "returns a 404 error if hook id is not available" do get api("/projects/#{project.id}/hooks/1234", user) expect(response).to have_http_status(404) end end describe "POST /projects/:id/hooks" do - it "should add hook to project" do + it "adds hook to project" do expect do post api("/projects/#{project.id}/hooks", user), url: "http://example.com", issues_events: true end.to change {project.hooks.count}.by(1) @@ -94,19 +94,19 @@ describe API::API, 'ProjectHooks', api: true do expect(json_response['enable_ssl_verification']).to eq(true) end - it "should return a 400 error if url not given" do + it "returns a 400 error if url not given" do post api("/projects/#{project.id}/hooks", user) expect(response).to have_http_status(400) end - it "should return a 422 error if url not valid" do + it "returns a 422 error if url not valid" do post api("/projects/#{project.id}/hooks", user), "url" => "ftp://example.com" expect(response).to have_http_status(422) end end describe "PUT /projects/:id/hooks/:hook_id" do - it "should update an existing project hook" do + it "updates an existing project hook" do put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'http://example.org', push_events: false expect(response).to have_http_status(200) @@ -119,46 +119,46 @@ describe API::API, 'ProjectHooks', api: true do expect(json_response['enable_ssl_verification']).to eq(hook.enable_ssl_verification) end - it "should return 404 error if hook id not found" do + it "returns 404 error if hook id not found" do put api("/projects/#{project.id}/hooks/1234", user), url: 'http://example.org' expect(response).to have_http_status(404) end - it "should return 400 error if url is not given" do + it "returns 400 error if url is not given" do put api("/projects/#{project.id}/hooks/#{hook.id}", user) expect(response).to have_http_status(400) end - it "should return a 422 error if url is not valid" do + it "returns a 422 error if url is not valid" do put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'ftp://example.com' expect(response).to have_http_status(422) end end describe "DELETE /projects/:id/hooks/:hook_id" do - it "should delete hook from project" do + it "deletes hook from project" do expect do delete api("/projects/#{project.id}/hooks/#{hook.id}", user) end.to change {project.hooks.count}.by(-1) expect(response).to have_http_status(200) end - it "should return success when deleting hook" do + it "returns success when deleting hook" do delete api("/projects/#{project.id}/hooks/#{hook.id}", user) expect(response).to have_http_status(200) end - it "should return a 404 error when deleting non existent hook" do + it "returns a 404 error when deleting non existent hook" do delete api("/projects/#{project.id}/hooks/42", user) expect(response).to have_http_status(404) end - it "should return a 405 error if hook id not given" do + it "returns a 405 error if hook id not given" do delete api("/projects/#{project.id}/hooks", user) expect(response).to have_http_status(405) end - it "shold return a 404 if a user attempts to delete project hooks he/she does not own" do + it "returns a 404 if a user attempts to delete project hooks he/she does not own" do test_user = create(:user) other_project = create(:project) other_project.team << [test_user, :master] |