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/notes_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/notes_spec.rb')
-rw-r--r-- | spec/requests/api/notes_spec.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 65c53211dd3..737fa14cbb0 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -37,7 +37,7 @@ describe API::API, api: true do end context "when noteable is an Issue" do - it "should return an array of issue notes" do + it "returns an array of issue notes" do get api("/projects/#{project.id}/issues/#{issue.id}/notes", user) expect(response).to have_http_status(200) @@ -45,14 +45,14 @@ describe API::API, api: true do expect(json_response.first['body']).to eq(issue_note.note) end - it "should return a 404 error when issue id not found" do + it "returns a 404 error when issue id not found" do get api("/projects/#{project.id}/issues/12345/notes", user) expect(response).to have_http_status(404) end context "and current user cannot view the notes" do - it "should return an empty array" do + it "returns an empty array" do get api("/projects/#{ext_proj.id}/issues/#{ext_issue.id}/notes", user) expect(response).to have_http_status(200) @@ -71,7 +71,7 @@ describe API::API, api: true do end context "and current user can view the note" do - it "should return an empty array" do + it "returns an empty array" do get api("/projects/#{ext_proj.id}/issues/#{ext_issue.id}/notes", private_user) expect(response).to have_http_status(200) @@ -83,7 +83,7 @@ describe API::API, api: true do end context "when noteable is a Snippet" do - it "should return an array of snippet notes" do + it "returns an array of snippet notes" do get api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user) expect(response).to have_http_status(200) @@ -91,7 +91,7 @@ describe API::API, api: true do expect(json_response.first['body']).to eq(snippet_note.note) end - it "should return a 404 error when snippet id not found" do + it "returns a 404 error when snippet id not found" do get api("/projects/#{project.id}/snippets/42/notes", user) expect(response).to have_http_status(404) @@ -105,7 +105,7 @@ describe API::API, api: true do end context "when noteable is a Merge Request" do - it "should return an array of merge_requests notes" do + it "returns an array of merge_requests notes" do get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/notes", user) expect(response).to have_http_status(200) @@ -113,7 +113,7 @@ describe API::API, api: true do expect(json_response.first['body']).to eq(merge_request_note.note) end - it "should return a 404 error if merge request id not found" do + it "returns a 404 error if merge request id not found" do get api("/projects/#{project.id}/merge_requests/4444/notes", user) expect(response).to have_http_status(404) @@ -129,21 +129,21 @@ describe API::API, api: true do describe "GET /projects/:id/noteable/:noteable_id/notes/:note_id" do context "when noteable is an Issue" do - it "should return an issue note by id" do + it "returns an issue note by id" do get api("/projects/#{project.id}/issues/#{issue.id}/notes/#{issue_note.id}", user) expect(response).to have_http_status(200) expect(json_response['body']).to eq(issue_note.note) end - it "should return a 404 error if issue note not found" do + it "returns a 404 error if issue note not found" do get api("/projects/#{project.id}/issues/#{issue.id}/notes/12345", user) expect(response).to have_http_status(404) end context "and current user cannot view the note" do - it "should return a 404 error" do + it "returns a 404 error" do get api("/projects/#{ext_proj.id}/issues/#{ext_issue.id}/notes/#{cross_reference_note.id}", user) expect(response).to have_http_status(404) @@ -160,7 +160,7 @@ describe API::API, api: true do end context "and current user can view the note" do - it "should return an issue note by id" do + it "returns an issue note by id" do get api("/projects/#{ext_proj.id}/issues/#{ext_issue.id}/notes/#{cross_reference_note.id}", private_user) expect(response).to have_http_status(200) @@ -171,14 +171,14 @@ describe API::API, api: true do end context "when noteable is a Snippet" do - it "should return a snippet note by id" do + it "returns a snippet note by id" do get api("/projects/#{project.id}/snippets/#{snippet.id}/notes/#{snippet_note.id}", user) expect(response).to have_http_status(200) expect(json_response['body']).to eq(snippet_note.note) end - it "should return a 404 error if snippet note not found" do + it "returns a 404 error if snippet note not found" do get api("/projects/#{project.id}/snippets/#{snippet.id}/notes/12345", user) expect(response).to have_http_status(404) @@ -188,7 +188,7 @@ describe API::API, api: true do describe "POST /projects/:id/noteable/:noteable_id/notes" do context "when noteable is an Issue" do - it "should create a new issue note" do + it "creates a new issue note" do post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' expect(response).to have_http_status(201) @@ -196,13 +196,13 @@ describe API::API, api: true do expect(json_response['author']['username']).to eq(user.username) end - it "should return a 400 bad request error if body not given" do + it "returns a 400 bad request error if body not given" do post api("/projects/#{project.id}/issues/#{issue.id}/notes", user) expect(response).to have_http_status(400) end - it "should return a 401 unauthorized error if user not authenticated" do + it "returns a 401 unauthorized error if user not authenticated" do post api("/projects/#{project.id}/issues/#{issue.id}/notes"), body: 'hi!' expect(response).to have_http_status(401) @@ -223,7 +223,7 @@ describe API::API, api: true do end context "when noteable is a Snippet" do - it "should create a new snippet note" do + it "creates a new snippet note" do post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!' expect(response).to have_http_status(201) @@ -231,13 +231,13 @@ describe API::API, api: true do expect(json_response['author']['username']).to eq(user.username) end - it "should return a 400 bad request error if body not given" do + it "returns a 400 bad request error if body not given" do post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user) expect(response).to have_http_status(400) end - it "should return a 401 unauthorized error if user not authenticated" do + it "returns a 401 unauthorized error if user not authenticated" do post api("/projects/#{project.id}/snippets/#{snippet.id}/notes"), body: 'hi!' expect(response).to have_http_status(401) @@ -267,7 +267,7 @@ describe API::API, api: true do end describe "POST /projects/:id/noteable/:noteable_id/notes to test observer on create" do - it "should create an activity event when an issue note is created" do + it "creates an activity event when an issue note is created" do expect(Event).to receive(:create) post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' @@ -276,7 +276,7 @@ describe API::API, api: true do describe 'PUT /projects/:id/noteable/:noteable_id/notes/:note_id' do context 'when noteable is an Issue' do - it 'should return modified note' do + it 'returns modified note' do put api("/projects/#{project.id}/issues/#{issue.id}/"\ "notes/#{issue_note.id}", user), body: 'Hello!' @@ -284,14 +284,14 @@ describe API::API, api: true do expect(json_response['body']).to eq('Hello!') end - it 'should return a 404 error when note id not found' do + it 'returns a 404 error when note id not found' do put api("/projects/#{project.id}/issues/#{issue.id}/notes/12345", user), body: 'Hello!' expect(response).to have_http_status(404) end - it 'should return a 400 bad request error if body not given' do + it 'returns a 400 bad request error if body not given' do put api("/projects/#{project.id}/issues/#{issue.id}/"\ "notes/#{issue_note.id}", user) @@ -300,7 +300,7 @@ describe API::API, api: true do end context 'when noteable is a Snippet' do - it 'should return modified note' do + it 'returns modified note' do put api("/projects/#{project.id}/snippets/#{snippet.id}/"\ "notes/#{snippet_note.id}", user), body: 'Hello!' @@ -308,7 +308,7 @@ describe API::API, api: true do expect(json_response['body']).to eq('Hello!') end - it 'should return a 404 error when note id not found' do + it 'returns a 404 error when note id not found' do put api("/projects/#{project.id}/snippets/#{snippet.id}/"\ "notes/12345", user), body: "Hello!" @@ -317,7 +317,7 @@ describe API::API, api: true do end context 'when noteable is a Merge Request' do - it 'should return modified note' do + it 'returns modified note' do put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/"\ "notes/#{merge_request_note.id}", user), body: 'Hello!' @@ -325,7 +325,7 @@ describe API::API, api: true do expect(json_response['body']).to eq('Hello!') end - it 'should return a 404 error when note id not found' do + it 'returns a 404 error when note id not found' do put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/"\ "notes/12345", user), body: "Hello!" |