Commit 90a3825c authored by Peter Leitzen's avatar Peter Leitzen Committed by Nick Thomas

Add http status cop to some subdir request specs

285 files inspected, 21 offenses detected, 21 offenses corrected
parent ffbbcfb7
...@@ -345,6 +345,8 @@ RSpec/HaveGitlabHttpStatus: ...@@ -345,6 +345,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/controllers/**/*' - 'ee/spec/controllers/**/*'
- 'spec/requests/*.rb' - 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb' - 'ee/spec/requests/*.rb'
- 'spec/requests/{groups,projects,repositories}/**/*'
- 'ee/spec/requests/{groups,projects,repositories}/**/*'
- 'spec/requests/api/*/**/*.rb' - 'spec/requests/api/*/**/*.rb'
- 'ee/spec/requests/api/*/**/*.rb' - 'ee/spec/requests/api/*/**/*.rb'
......
...@@ -18,7 +18,7 @@ describe Groups::RoadmapController do ...@@ -18,7 +18,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group, layout: layout) get group_roadmap_path(group, layout: layout)
end.not_to change { user.reload.roadmap_layout } end.not_to change { user.reload.roadmap_layout }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -36,7 +36,7 @@ describe Groups::RoadmapController do ...@@ -36,7 +36,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group) get group_roadmap_path(group)
end.not_to change { user.reload.roadmap_layout } end.not_to change { user.reload.roadmap_layout }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -45,7 +45,7 @@ describe Groups::RoadmapController do ...@@ -45,7 +45,7 @@ describe Groups::RoadmapController do
expect(Users::UpdateService).not_to receive(:new).with(user, user: user, roadmap_layout: a_kind_of(String)) expect(Users::UpdateService).not_to receive(:new).with(user, user: user, roadmap_layout: a_kind_of(String))
get group_roadmap_path(group, layout: 'FOO') get group_roadmap_path(group, layout: 'FOO')
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -58,7 +58,7 @@ describe Groups::RoadmapController do ...@@ -58,7 +58,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group, layout: layout) get group_roadmap_path(group, layout: layout)
end.to change { user.reload.roadmap_layout }.to(layout.downcase) end.to change { user.reload.roadmap_layout }.to(layout.downcase)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -33,7 +33,7 @@ describe 'GET /groups/*group_id/-/security/projects' do ...@@ -33,7 +33,7 @@ describe 'GET /groups/*group_id/-/security/projects' do
get group_security_vulnerable_projects_path(group, format: :json) get group_security_vulnerable_projects_path(group, format: :json)
end.not_to exceed_query_limit(control_count) end.not_to exceed_query_limit(control_count)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to be(3) expect(json_response.size).to be(3)
end end
end end
...@@ -20,7 +20,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do ...@@ -20,7 +20,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is success' do it 'is success' do
get project_analytics_code_reviews_path(project) get project_analytics_code_reviews_path(project)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -32,7 +32,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do ...@@ -32,7 +32,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is not found' do it 'is not found' do
get project_analytics_code_reviews_path(project) get project_analytics_code_reviews_path(project)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -45,7 +45,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do ...@@ -45,7 +45,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is not found' do it 'is not found' do
get project_analytics_code_reviews_path(project) get project_analytics_code_reviews_path(project)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -25,7 +25,7 @@ describe Projects::IssueLinksController do ...@@ -25,7 +25,7 @@ describe Projects::IssueLinksController do
get namespace_project_issue_links_path(issue_links_params) get namespace_project_issue_links_path(issue_links_params)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq(list_service_response.as_json) expect(json_response).to eq(list_service_response.as_json)
end end
end end
...@@ -47,7 +47,7 @@ describe Projects::IssueLinksController do ...@@ -47,7 +47,7 @@ describe Projects::IssueLinksController do
list_service_response = IssueLinks::ListService.new(issue, user).execute list_service_response = IssueLinks::ListService.new(issue, user).execute
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq('message' => nil, expect(json_response).to eq('message' => nil,
'issuables' => list_service_response.as_json) 'issuables' => list_service_response.as_json)
end end
...@@ -61,7 +61,7 @@ describe Projects::IssueLinksController do ...@@ -61,7 +61,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do it 'returns 403' do
post namespace_project_issue_links_path(issue_links_params(issuable_references: issuable_references)) post namespace_project_issue_links_path(issue_links_params(issuable_references: issuable_references))
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -74,7 +74,7 @@ describe Projects::IssueLinksController do ...@@ -74,7 +74,7 @@ describe Projects::IssueLinksController do
list_service_response = IssueLinks::ListService.new(issue, user).execute list_service_response = IssueLinks::ListService.new(issue, user).execute
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(json_response).to eq('message' => 'No Issue found for given params', 'issuables' => list_service_response.as_json) expect(json_response).to eq('message' => 'No Issue found for given params', 'issuables' => list_service_response.as_json)
end end
end end
...@@ -97,7 +97,7 @@ describe Projects::IssueLinksController do ...@@ -97,7 +97,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do it 'returns 403' do
delete namespace_project_issue_link_path(issue_links_params(id: issue_link.id)) delete namespace_project_issue_link_path(issue_links_params(id: issue_link.id))
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -109,7 +109,7 @@ describe Projects::IssueLinksController do ...@@ -109,7 +109,7 @@ describe Projects::IssueLinksController do
it 'returns 404' do it 'returns 404' do
delete namespace_project_issue_link_path(issue_links_params(id: issue_link.id)) delete namespace_project_issue_link_path(issue_links_params(id: issue_link.id))
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -142,7 +142,7 @@ describe Projects::IssueLinksController do ...@@ -142,7 +142,7 @@ describe Projects::IssueLinksController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not delete the link' do it 'does not delete the link' do
......
...@@ -28,7 +28,7 @@ describe Projects::MirrorsController do ...@@ -28,7 +28,7 @@ describe Projects::MirrorsController do
} }
} }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings')) expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings'))
expect(flash[:alert]).to include("Import url can't be blank") expect(flash[:alert]).to include("Import url can't be blank")
end end
......
...@@ -37,7 +37,7 @@ describe Repositories::GitHttpController, type: :request do ...@@ -37,7 +37,7 @@ describe Repositories::GitHttpController, type: :request do
it "allows access" do it "allows access" do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -45,7 +45,7 @@ describe Repositories::GitHttpController, type: :request do ...@@ -45,7 +45,7 @@ describe Repositories::GitHttpController, type: :request do
it "does not allow access" do it "does not allow access" do
subject subject
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq('Project requires smartcard login. Please login to GitLab using a smartcard.') expect(response.body).to eq('Project requires smartcard login. Please login to GitLab using a smartcard.')
end end
end end
...@@ -58,7 +58,7 @@ describe Repositories::GitHttpController, type: :request do ...@@ -58,7 +58,7 @@ describe Repositories::GitHttpController, type: :request do
it "allows access" do it "allows access" do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -24,7 +24,7 @@ describe Groups::MilestonesController do ...@@ -24,7 +24,7 @@ describe Groups::MilestonesController do
end end
expect { get "/groups/#{public_group.to_param}/-/milestones.json" }.not_to exceed_all_query_limit(control_count) expect { get "/groups/#{public_group.to_param}/-/milestones.json" }.not_to exceed_all_query_limit(control_count)
expect(response).to have_http_status(200) expect(response).to have_gitlab_http_status(:ok)
milestones = json_response milestones = json_response
expect(milestones.count).to eq(3) expect(milestones.count).to eq(3)
......
...@@ -28,7 +28,7 @@ describe Groups::Registry::RepositoriesController do ...@@ -28,7 +28,7 @@ describe Groups::Registry::RepositoriesController do
expect { get(endpoint) }.not_to exceed_all_query_limit(control_count) expect { get(endpoint) }.not_to exceed_all_query_limit(control_count)
# sanity check that response is 200 # sanity check that response is 200
expect(response).to have_http_status(200) expect(response).to have_gitlab_http_status(:ok)
repositories = json_response repositories = json_response
expect(repositories.count).to eq(5) expect(repositories.count).to eq(5)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment