diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-10-24 07:52:21 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-10-24 07:52:21 +0000 |
commit | f7bdfe5098c9a5a3a426344ba1d7dd668212cf7e (patch) | |
tree | 5a1cb2a90b0a2b5114f6f23712b68724b3e8a7e0 /spec/requests/api/v3/issues_spec.rb | |
parent | 9cd528aa7ac5066570cb50b909951a6c6b723935 (diff) | |
parent | e16add2267648d3d3ef1d98f9b53f67a29428791 (diff) | |
download | gitlab-ce-es-module-autosave.tar.gz |
Merge branch 'master' into 'es-module-autosave'es-module-autosave
# Conflicts:
# app/assets/javascripts/issuable_form.js
# app/assets/javascripts/notes.js
Diffstat (limited to 'spec/requests/api/v3/issues_spec.rb')
-rw-r--r-- | spec/requests/api/v3/issues_spec.rb | 236 |
1 files changed, 118 insertions, 118 deletions
diff --git a/spec/requests/api/v3/issues_spec.rb b/spec/requests/api/v3/issues_spec.rb index 86768d7397a..39a47a62f16 100644 --- a/spec/requests/api/v3/issues_spec.rb +++ b/spec/requests/api/v3/issues_spec.rb @@ -59,7 +59,7 @@ describe API::V3::Issues, :mailer do it "returns authentication error" do get v3_api("/issues") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end @@ -67,7 +67,7 @@ describe API::V3::Issues, :mailer do it "returns an array of issues" do get v3_api("/issues", 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.first['title']).to eq(issue.title) expect(json_response.last).to have_key('web_url') @@ -76,7 +76,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of closed issues' do get v3_api('/issues?state=closed', 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.length).to eq(1) expect(json_response.first['id']).to eq(closed_issue.id) @@ -85,7 +85,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of opened issues' do get v3_api('/issues?state=opened', 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.length).to eq(1) expect(json_response.first['id']).to eq(issue.id) @@ -94,7 +94,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of all issues' do get v3_api('/issues?state=all', 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.length).to eq(2) expect(json_response.first['id']).to eq(issue.id) @@ -104,7 +104,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled issues' do get v3_api("/issues?labels=#{label.title}", 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.length).to eq(1) expect(json_response.first['labels']).to eq([label.title]) @@ -113,7 +113,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled issues when at least one label matches' do get v3_api("/issues?labels=#{label.title},foo,bar", 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.length).to eq(1) expect(json_response.first['labels']).to eq([label.title]) @@ -122,7 +122,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no issue matches labels' do get v3_api('/issues?labels=foo,bar', 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.length).to eq(0) end @@ -130,7 +130,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled issues matching given state' do get v3_api("/issues?labels=#{label.title}&state=opened", 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.length).to eq(1) expect(json_response.first['labels']).to eq([label.title]) @@ -140,7 +140,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no issue matches labels and state filters' do get v3_api("/issues?labels=#{label.title}&state=closed", 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.length).to eq(0) end @@ -148,7 +148,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no issue matches milestone' do get v3_api("/issues?milestone=#{empty_milestone.title}", 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.length).to eq(0) end @@ -156,7 +156,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if milestone does not exist' do get v3_api("/issues?milestone=foo", 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.length).to eq(0) end @@ -164,7 +164,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues in given milestone' do get v3_api("/issues?milestone=#{milestone.title}", 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.length).to eq(2) expect(json_response.first['id']).to eq(issue.id) @@ -175,7 +175,7 @@ describe API::V3::Issues, :mailer do get v3_api("/issues?milestone=#{milestone.title}", user), '&state=closed' - 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.length).to eq(1) expect(json_response.first['id']).to eq(closed_issue.id) @@ -184,7 +184,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues with no milestone' do get v3_api("/issues?milestone=#{no_milestone_title}", author) - 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.length).to eq(1) expect(json_response.first['id']).to eq(confidential_issue.id) @@ -195,7 +195,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -205,7 +205,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -215,7 +215,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -225,7 +225,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -233,7 +233,7 @@ describe API::V3::Issues, :mailer do it 'matches V3 response schema' do get v3_api('/issues', user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to match_response_schema('public_api/v3/issues') end end @@ -285,7 +285,7 @@ describe API::V3::Issues, :mailer do it 'returns all group issues (including opened and closed)' do get v3_api(base_url, admin) - 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.length).to eq(3) end @@ -293,7 +293,7 @@ describe API::V3::Issues, :mailer do it 'returns group issues without confidential issues for non project members' do get v3_api("#{base_url}?state=opened", non_member) - 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.length).to eq(1) expect(json_response.first['title']).to eq(group_issue.title) @@ -302,7 +302,7 @@ describe API::V3::Issues, :mailer do it 'returns group confidential issues for author' do get v3_api("#{base_url}?state=opened", author) - 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.length).to eq(2) end @@ -310,7 +310,7 @@ describe API::V3::Issues, :mailer do it 'returns group confidential issues for assignee' do get v3_api("#{base_url}?state=opened", assignee) - 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.length).to eq(2) end @@ -318,7 +318,7 @@ describe API::V3::Issues, :mailer do it 'returns group issues with confidential issues for project members' do get v3_api("#{base_url}?state=opened", 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.length).to eq(2) end @@ -326,7 +326,7 @@ describe API::V3::Issues, :mailer do it 'returns group confidential issues for admin' do get v3_api("#{base_url}?state=opened", admin) - 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.length).to eq(2) end @@ -334,7 +334,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled group issues' do get v3_api("#{base_url}?labels=#{group_label.title}", 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.length).to eq(1) expect(json_response.first['labels']).to eq([group_label.title]) @@ -343,7 +343,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled group issues where all labels match' do get v3_api("#{base_url}?labels=#{group_label.title},foo,bar", 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.length).to eq(0) end @@ -351,7 +351,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no group issue matches labels' do get v3_api("#{base_url}?labels=foo,bar", 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.length).to eq(0) end @@ -359,7 +359,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no issue matches milestone' do get v3_api("#{base_url}?milestone=#{group_empty_milestone.title}", 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.length).to eq(0) end @@ -367,7 +367,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if milestone does not exist' do get v3_api("#{base_url}?milestone=foo", 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.length).to eq(0) end @@ -375,7 +375,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues in given milestone' do get v3_api("#{base_url}?state=opened&milestone=#{group_milestone.title}", 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.length).to eq(1) expect(json_response.first['id']).to eq(group_issue.id) @@ -385,7 +385,7 @@ describe API::V3::Issues, :mailer do get v3_api("#{base_url}?milestone=#{group_milestone.title}", user), '&state=closed' - 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.length).to eq(1) expect(json_response.first['id']).to eq(group_closed_issue.id) @@ -394,7 +394,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues with no milestone' do get v3_api("#{base_url}?milestone=#{no_milestone_title}", 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.length).to eq(1) expect(json_response.first['id']).to eq(group_confidential_issue.id) @@ -405,7 +405,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -415,7 +415,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -425,7 +425,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -435,7 +435,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -447,7 +447,7 @@ describe API::V3::Issues, :mailer do it 'returns 404 when project does not exist' do get v3_api('/projects/1000/issues', non_member) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns 404 on private projects for other users" do @@ -456,7 +456,7 @@ describe API::V3::Issues, :mailer do get v3_api("/projects/#{private_project.id}/issues", non_member) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'returns no issues when user has access to project but not issues' do @@ -471,7 +471,7 @@ describe API::V3::Issues, :mailer do it 'returns project issues without confidential issues for non project members' do get v3_api("#{base_url}/issues", non_member) - 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.length).to eq(2) expect(json_response.first['title']).to eq(issue.title) @@ -480,7 +480,7 @@ describe API::V3::Issues, :mailer do it 'returns project issues without confidential issues for project members with guest role' do get v3_api("#{base_url}/issues", guest) - 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.length).to eq(2) expect(json_response.first['title']).to eq(issue.title) @@ -489,7 +489,7 @@ describe API::V3::Issues, :mailer do it 'returns project confidential issues for author' do get v3_api("#{base_url}/issues", author) - 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.length).to eq(3) expect(json_response.first['title']).to eq(issue.title) @@ -498,7 +498,7 @@ describe API::V3::Issues, :mailer do it 'returns project confidential issues for assignee' do get v3_api("#{base_url}/issues", assignee) - 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.length).to eq(3) expect(json_response.first['title']).to eq(issue.title) @@ -507,7 +507,7 @@ describe API::V3::Issues, :mailer do it 'returns project issues with confidential issues for project members' do get v3_api("#{base_url}/issues", 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.length).to eq(3) expect(json_response.first['title']).to eq(issue.title) @@ -516,7 +516,7 @@ describe API::V3::Issues, :mailer do it 'returns project confidential issues for admin' do get v3_api("#{base_url}/issues", admin) - 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.length).to eq(3) expect(json_response.first['title']).to eq(issue.title) @@ -525,7 +525,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled project issues' do get v3_api("#{base_url}/issues?labels=#{label.title}", 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.length).to eq(1) expect(json_response.first['labels']).to eq([label.title]) @@ -534,7 +534,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of labeled project issues where all labels match' do get v3_api("#{base_url}/issues?labels=#{label.title},foo,bar", 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.length).to eq(1) expect(json_response.first['labels']).to eq([label.title]) @@ -543,7 +543,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no project issue matches labels' do get v3_api("#{base_url}/issues?labels=foo,bar", 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.length).to eq(0) end @@ -551,7 +551,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if no issue matches milestone' do get v3_api("#{base_url}/issues?milestone=#{empty_milestone.title}", 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.length).to eq(0) end @@ -559,7 +559,7 @@ describe API::V3::Issues, :mailer do it 'returns an empty array if milestone does not exist' do get v3_api("#{base_url}/issues?milestone=foo", 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.length).to eq(0) end @@ -567,7 +567,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues in given milestone' do get v3_api("#{base_url}/issues?milestone=#{milestone.title}", 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.length).to eq(2) expect(json_response.first['id']).to eq(issue.id) @@ -578,7 +578,7 @@ describe API::V3::Issues, :mailer do get v3_api("#{base_url}/issues?milestone=#{milestone.title}", user), '&state=closed' - 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.length).to eq(1) expect(json_response.first['id']).to eq(closed_issue.id) @@ -587,7 +587,7 @@ describe API::V3::Issues, :mailer do it 'returns an array of issues with no milestone' do get v3_api("#{base_url}/issues?milestone=#{no_milestone_title}", 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.length).to eq(1) expect(json_response.first['id']).to eq(confidential_issue.id) @@ -598,7 +598,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -608,7 +608,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['created_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -618,7 +618,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort.reverse) end @@ -628,7 +628,7 @@ describe API::V3::Issues, :mailer do response_dates = json_response.map { |issue| issue['updated_at'] } - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array expect(response_dates).to eq(response_dates.sort) end @@ -638,7 +638,7 @@ describe API::V3::Issues, :mailer do it 'exposes known attributes' do get v3_api("/projects/#{project.id}/issues/#{issue.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['id']).to eq(issue.id) expect(json_response['iid']).to eq(issue.iid) expect(json_response['project_id']).to eq(issue.project.id) @@ -657,7 +657,7 @@ describe API::V3::Issues, :mailer do it "returns a project issue by id" do get v3_api("/projects/#{project.id}/issues/#{issue.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(issue.title) expect(json_response['iid']).to eq(issue.iid) end @@ -682,26 +682,26 @@ describe API::V3::Issues, :mailer do it "returns 404 if issue id not found" do get v3_api("/projects/#{project.id}/issues/54321", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end context 'confidential issues' do it "returns 404 for non project members" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", non_member) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns 404 for project members with guest role" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", guest) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "returns confidential issue for project members" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(confidential_issue.title) expect(json_response['iid']).to eq(confidential_issue.iid) end @@ -709,7 +709,7 @@ describe API::V3::Issues, :mailer do it "returns confidential issue for author" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", author) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(confidential_issue.title) expect(json_response['iid']).to eq(confidential_issue.iid) end @@ -717,7 +717,7 @@ describe API::V3::Issues, :mailer do it "returns confidential issue for assignee" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", assignee) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(confidential_issue.title) expect(json_response['iid']).to eq(confidential_issue.iid) end @@ -725,7 +725,7 @@ describe API::V3::Issues, :mailer do it "returns confidential issue for admin" do get v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(confidential_issue.title) expect(json_response['iid']).to eq(confidential_issue.iid) end @@ -737,7 +737,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', labels: 'label, label2', assignee_id: assignee.id - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new issue') expect(json_response['description']).to be_nil expect(json_response['labels']).to eq(%w(label label2)) @@ -749,7 +749,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', confidential: true - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new issue') expect(json_response['confidential']).to be_truthy end @@ -758,7 +758,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', confidential: 'y' - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new issue') expect(json_response['confidential']).to be_truthy end @@ -767,7 +767,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', confidential: false - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new issue') expect(json_response['confidential']).to be_falsy end @@ -776,7 +776,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', confidential: 'foo' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('confidential is invalid') end @@ -795,7 +795,7 @@ describe API::V3::Issues, :mailer do it "returns a 400 bad request if title not given" do post v3_api("/projects/#{project.id}/issues", user), labels: 'label, label2' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it 'allows special label names' do @@ -815,7 +815,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'g' * 256 - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['title']).to eq([ 'is too long (maximum is 255 characters)' ]) @@ -834,7 +834,7 @@ describe API::V3::Issues, :mailer do end it 'creates a new project issue' do - expect(response).to have_http_status(:created) + expect(response).to have_gitlab_http_status(:created) end it 'resolves the discussions in a merge request' do @@ -855,7 +855,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', due_date: due_date - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new issue') expect(json_response['description']).to be_nil expect(json_response['due_date']).to eq(due_date) @@ -868,7 +868,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues", user), title: 'new issue', labels: 'label, label2', created_at: creation_time - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time) end end @@ -899,7 +899,7 @@ describe API::V3::Issues, :mailer do it "does not create a new project issue" do expect { post v3_api("/projects/#{project.id}/issues", user), params }.not_to change(Issue, :count) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq({ "error" => "Spam detected" }) spam_logs = SpamLog.all @@ -917,7 +917,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), title: 'updated title' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq('updated title') end @@ -925,7 +925,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/44444", user), title: 'updated title' - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'allows special label names' do @@ -946,21 +946,21 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", non_member), title: 'updated title' - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it "returns 403 for project members with guest role" do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", guest), title: 'updated title' - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it "updates a confidential issue for project members" do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", user), title: 'updated title' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq('updated title') end @@ -968,7 +968,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", author), title: 'updated title' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq('updated title') end @@ -976,7 +976,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", admin), title: 'updated title' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq('updated title') end @@ -984,7 +984,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), confidential: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['confidential']).to be_truthy end @@ -992,7 +992,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", user), confidential: false - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['confidential']).to be_falsy end @@ -1000,7 +1000,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}", user), confidential: 'foo' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('confidential is invalid') end end @@ -1021,7 +1021,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), params - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq({ "error" => "Spam detected" }) spam_logs = SpamLog.all @@ -1041,7 +1041,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), title: 'updated title' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['labels']).to eq([label.title]) end @@ -1060,7 +1060,7 @@ describe API::V3::Issues, :mailer do it 'removes all labels' do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), labels: '' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['labels']).to eq([]) end @@ -1068,7 +1068,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), labels: 'foo,bar' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['labels']).to include 'foo' expect(json_response['labels']).to include 'bar' end @@ -1092,7 +1092,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), title: 'g' * 256 - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']['title']).to eq([ 'is too long (maximum is 255 characters)' ]) @@ -1104,7 +1104,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), labels: 'label2', state_event: "close" - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['labels']).to include 'label2' expect(json_response['state']).to eq "closed" end @@ -1112,7 +1112,7 @@ describe API::V3::Issues, :mailer do it 'reopens a project isssue' do put v3_api("/projects/#{project.id}/issues/#{closed_issue.id}", user), state_event: 'reopen' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['state']).to eq 'opened' end @@ -1122,7 +1122,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), labels: 'label3', state_event: 'close', updated_at: update_time - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['labels']).to include 'label3' expect(Time.parse(json_response['updated_at'])).to be_like_time(update_time) end @@ -1135,7 +1135,7 @@ describe API::V3::Issues, :mailer do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), due_date: due_date - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['due_date']).to eq(due_date) end end @@ -1144,14 +1144,14 @@ describe API::V3::Issues, :mailer do it 'updates an issue with no assignee' do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), assignee_id: 0 - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['assignee']).to eq(nil) end it 'updates an issue with assignee' do put v3_api("/projects/#{project.id}/issues/#{issue.id}", user), assignee_id: user2.id - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['assignee']['name']).to eq(user2.name) end end @@ -1160,13 +1160,13 @@ describe API::V3::Issues, :mailer do it "rejects a non member from deleting an issue" do delete v3_api("/projects/#{project.id}/issues/#{issue.id}", non_member) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it "rejects a developer from deleting an issue" do delete v3_api("/projects/#{project.id}/issues/#{issue.id}", author) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end context "when the user is project owner" do @@ -1176,7 +1176,7 @@ describe API::V3::Issues, :mailer do it "deletes the issue if an admin requests it" do delete v3_api("/projects/#{project.id}/issues/#{issue.id}", owner) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['state']).to eq 'opened' end end @@ -1185,7 +1185,7 @@ describe API::V3::Issues, :mailer do it 'returns 404 when trying to move an issue' do delete v3_api("/projects/#{project.id}/issues/123", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -1198,7 +1198,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/#{issue.id}/move", user), to_project_id: target_project.id - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['project_id']).to eq(target_project.id) end @@ -1207,7 +1207,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/#{issue.id}/move", user), to_project_id: project.id - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq('Cannot move issue to project it originates from!') end end @@ -1217,7 +1217,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/#{issue.id}/move", user), to_project_id: target_project2.id - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq('Cannot move issue due to insufficient permissions!') end end @@ -1226,7 +1226,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/#{issue.id}/move", admin), to_project_id: target_project2.id - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['project_id']).to eq(target_project2.id) end @@ -1235,7 +1235,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/123/move", user), to_project_id: target_project.id - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Issue Not Found') end end @@ -1245,7 +1245,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/123/issues/#{issue.id}/move", user), to_project_id: target_project.id - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Project Not Found') end end @@ -1255,7 +1255,7 @@ describe API::V3::Issues, :mailer do post v3_api("/projects/#{project.id}/issues/#{issue.id}/move", user), to_project_id: 123 - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -1264,26 +1264,26 @@ describe API::V3::Issues, :mailer do it 'subscribes to an issue' do post v3_api("/projects/#{project.id}/issues/#{issue.id}/subscription", user2) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['subscribed']).to eq(true) end it 'returns 304 if already subscribed' do post v3_api("/projects/#{project.id}/issues/#{issue.id}/subscription", user) - expect(response).to have_http_status(304) + expect(response).to have_gitlab_http_status(304) end it 'returns 404 if the issue is not found' do post v3_api("/projects/#{project.id}/issues/123/subscription", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'returns 404 if the issue is confidential' do post v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}/subscription", non_member) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -1291,26 +1291,26 @@ describe API::V3::Issues, :mailer do it 'unsubscribes from an issue' do delete v3_api("/projects/#{project.id}/issues/#{issue.id}/subscription", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['subscribed']).to eq(false) end it 'returns 304 if not subscribed' do delete v3_api("/projects/#{project.id}/issues/#{issue.id}/subscription", user2) - expect(response).to have_http_status(304) + expect(response).to have_gitlab_http_status(304) end it 'returns 404 if the issue is not found' do delete v3_api("/projects/#{project.id}/issues/123/subscription", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'returns 404 if the issue is confidential' do delete v3_api("/projects/#{project.id}/issues/#{confidential_issue.id}/subscription", non_member) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end |