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:
- 'ee/spec/controllers/**/*'
- 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb'
- 'spec/requests/{groups,projects,repositories}/**/*'
- 'ee/spec/requests/{groups,projects,repositories}/**/*'
- 'spec/requests/api/*/**/*.rb'
- 'ee/spec/requests/api/*/**/*.rb'
......
......@@ -18,7 +18,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group, layout: 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
......@@ -36,7 +36,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group)
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
......@@ -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))
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
......@@ -58,7 +58,7 @@ describe Groups::RoadmapController do
get group_roadmap_path(group, layout: layout)
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
......
......@@ -33,7 +33,7 @@ describe 'GET /groups/*group_id/-/security/projects' do
get group_security_vulnerable_projects_path(group, format: :json)
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)
end
end
......@@ -20,7 +20,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is success' do
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
......@@ -32,7 +32,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is not found' do
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
......@@ -45,7 +45,7 @@ describe Projects::Analytics::CodeReviewsController, type: :request do
it 'is not found' do
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
......
......@@ -25,7 +25,7 @@ describe Projects::IssueLinksController do
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)
end
end
......@@ -47,7 +47,7 @@ describe Projects::IssueLinksController do
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,
'issuables' => list_service_response.as_json)
end
......@@ -61,7 +61,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do
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
......@@ -74,7 +74,7 @@ describe Projects::IssueLinksController do
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)
end
end
......@@ -97,7 +97,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do
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
......@@ -109,7 +109,7 @@ describe Projects::IssueLinksController do
it 'returns 404' do
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
......@@ -142,7 +142,7 @@ describe Projects::IssueLinksController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not delete the link' 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(flash[:alert]).to include("Import url can't be blank")
end
......
......@@ -37,7 +37,7 @@ describe Repositories::GitHttpController, type: :request do
it "allows access" do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -45,7 +45,7 @@ describe Repositories::GitHttpController, type: :request do
it "does not allow access" do
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.')
end
end
......@@ -58,7 +58,7 @@ describe Repositories::GitHttpController, type: :request do
it "allows access" do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -24,7 +24,7 @@ describe Groups::MilestonesController do
end
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
expect(milestones.count).to eq(3)
......
......@@ -28,7 +28,7 @@ describe Groups::Registry::RepositoriesController do
expect { get(endpoint) }.not_to exceed_all_query_limit(control_count)
# sanity check that response is 200
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
repositories = json_response
expect(repositories.count).to eq(5)
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