Commit be61adb6 authored by Alessio Caiazza's avatar Alessio Caiazza

Merge branch 'pl-rubocop-have-gitlab-http-status-spec-controllers-4' into 'master'

Add http status cop to all group controller specs

See merge request gitlab-org/gitlab!24211
parents 6ea25b65 1d2fb8cf
......@@ -343,6 +343,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/controllers/*.rb'
- 'spec/controllers/projects/**/*.rb'
- 'ee/spec/controllers/projects/**/*.rb'
- 'spec/controllers/groups/**/*.rb'
- 'ee/spec/controllers/groups/**/*.rb'
- 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb'
......
......@@ -32,7 +32,7 @@ describe Groups::AuditEventsController do
request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
......@@ -87,7 +87,7 @@ describe Groups::AuditEventsController do
it 'renders 404' do
request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -17,7 +17,7 @@ describe Groups::AutocompleteSourcesController do
it 'returns 200 status' do
get :epics, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the correct response' do
......@@ -41,7 +41,7 @@ describe Groups::AutocompleteSourcesController do
get :milestones, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.count).to eq(1)
expect(json_response.first).to include(
'iid' => group_milestone.iid, 'title' => group_milestone.title
......@@ -53,7 +53,7 @@ describe Groups::AutocompleteSourcesController do
it 'returns 200 status' do
get :commands, params: { group_id: group, type: 'Epic', type_id: epic.iid }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the correct response' do
......
......@@ -23,7 +23,7 @@ describe Groups::BillingsController do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
......@@ -44,7 +44,7 @@ describe Groups::BillingsController do
get :index, params: { group_id: group.id }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'renders 404 when it is not gitlab.com' do
......@@ -54,7 +54,7 @@ describe Groups::BillingsController do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -37,7 +37,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do
list_boards format: :json
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json'
end
end
......@@ -68,7 +68,7 @@ describe Groups::BoardsController do
list_boards(recent: true)
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
......
......@@ -42,7 +42,7 @@ describe Groups::ClustersController do
it 'renders not found' do
get :prometheus_proxy, params: prometheus_proxy_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'with invalid clusterable id' do
......
......@@ -45,7 +45,7 @@ describe Groups::ContributionAnalyticsController do
get :show, params: { group_id: group.path }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'unlicensed but we show promotions' do
......@@ -60,14 +60,14 @@ describe Groups::ContributionAnalyticsController do
get :show, params: { group_id: group.path }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'sets instance variables properly', :aggregate_failures do
get :show, params: { group_id: group.path }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns[:data_collector].users).to match_array([user, user2, user3])
expect(assigns[:data_collector].total_events_by_author_count.values.sum).to eq(6)
......
......@@ -20,7 +20,7 @@ describe Groups::DependencyProxiesController do
it 'returns 200 and renders the view' do
get :show, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('groups/dependency_proxies/show')
end
end
......@@ -28,7 +28,7 @@ describe Groups::DependencyProxiesController do
it 'returns 404 when feature is disabled' do
get :show, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -41,14 +41,14 @@ describe Groups::DependencyProxiesController do
it 'redirects back to show page' do
put :update, params: update_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
it 'returns 404 when feature is disabled' do
put :update, params: update_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
def update_params
......
......@@ -40,7 +40,7 @@ describe Groups::DependencyProxyForContainersController do
it 'proxies status from the remote token request' do
get_manifest
expect(response).to have_gitlab_http_status(503)
expect(response).to have_gitlab_http_status(:service_unavailable)
expect(response.body).to eq('Service Unavailable')
end
end
......@@ -57,7 +57,7 @@ describe Groups::DependencyProxyForContainersController do
it 'proxies status from the remote manifest request' do
get_manifest
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(response.body).to be_empty
end
end
......@@ -65,7 +65,7 @@ describe Groups::DependencyProxyForContainersController do
it 'returns 200 with manifest file' do
get_manifest
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(manifest)
end
end
......@@ -73,7 +73,7 @@ describe Groups::DependencyProxyForContainersController do
it 'returns 404 when feature is disabled' do
get_manifest
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
def get_manifest
......@@ -108,7 +108,7 @@ describe Groups::DependencyProxyForContainersController do
it 'proxies status from the remote blob request' do
get_blob
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(response.body).to be_empty
end
end
......@@ -130,7 +130,7 @@ describe Groups::DependencyProxyForContainersController do
it 'returns 404 when feature is disabled' do
get_blob
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
def get_blob
......
......@@ -25,7 +25,7 @@ describe Groups::EpicIssuesController do
end
it 'returns 400 status' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -59,7 +59,7 @@ describe Groups::EpicIssuesController do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -84,7 +84,7 @@ describe Groups::EpicIssuesController do
subject
list_service_response = EpicIssues::ListService.new(epic, 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
......@@ -97,7 +97,7 @@ describe Groups::EpicIssuesController do
it 'returns correct response for the correct issue reference' do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'does not create a new EpicIssue record' do
......
......@@ -22,7 +22,7 @@ describe Groups::EpicLinksController do
end
it 'returns 400 status' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -50,7 +50,7 @@ describe Groups::EpicLinksController do
it 'returns the correct JSON response' do
list_service_response = EpicLinks::ListService.new(parent_epic, user).execute
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
......@@ -61,7 +61,7 @@ describe Groups::EpicLinksController do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -90,7 +90,7 @@ describe Groups::EpicLinksController do
subject
list_service_response = EpicLinks::ListService.new(parent_epic, 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
......@@ -103,7 +103,7 @@ describe Groups::EpicLinksController do
it 'returns 403 status' do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'does not update parent attribute' do
......@@ -140,7 +140,7 @@ describe Groups::EpicLinksController do
it 'returns status 200' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'updates the epic position' do
......@@ -153,7 +153,7 @@ describe Groups::EpicLinksController do
it 'returns status 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -162,7 +162,7 @@ describe Groups::EpicLinksController do
it 'returns status 403' do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......
......@@ -66,13 +66,13 @@ describe Groups::Epics::NotesController do
it "returns status 302 for html" do
post :create, params: request_params.merge(format: :html)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it "returns status 200 for json" do
post :create, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(parsed_response[:id]).not_to be_nil
end
......@@ -95,7 +95,7 @@ describe Groups::Epics::NotesController do
it "creates reply note for discussion" do
post :create, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(parsed_response[:errors]).to be_nil
end
end
......@@ -143,7 +143,7 @@ describe Groups::Epics::NotesController do
it "returns status 200" do
delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "deletes the note" do
......@@ -159,7 +159,7 @@ describe Groups::Epics::NotesController do
it "returns status 404" do
delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -183,7 +183,7 @@ describe Groups::Epics::NotesController do
post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
end.to change { note.award_emoji.count }.by(1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "removes the already awarded emoji" do
......@@ -193,7 +193,7 @@ describe Groups::Epics::NotesController do
post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
end.to change { AwardEmoji.count }.by(-1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -17,7 +17,7 @@ describe Groups::EpicsController do
it 'returns 404 status' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -56,7 +56,7 @@ describe Groups::EpicsController do
it "returns index" do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'when there is no logged in user' do
......@@ -67,7 +67,7 @@ describe Groups::EpicsController do
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(cookies['epic_sort']).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -77,7 +77,7 @@ describe Groups::EpicsController do
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(user.user_preference.epics_sort).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -88,7 +88,7 @@ describe Groups::EpicsController do
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(user.reload.user_preference.epics_sort).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -110,7 +110,7 @@ describe Groups::EpicsController do
get :index, params: { group_id: group, page: last_page.to_param }
expect(assigns(:epics).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'disabled when using an external authorization service' do
......@@ -216,7 +216,7 @@ describe Groups::EpicsController do
it 'the link to the issue is included' do
get :discussions, params: { group_id: group, id: epic.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to eq(1)
discussion = json_response[0]
notes = discussion["notes"]
......@@ -266,7 +266,7 @@ describe Groups::EpicsController do
it 'returns a not found 404 response' do
show_epic
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html'
end
end
......@@ -285,7 +285,7 @@ describe Groups::EpicsController do
group.add_developer(user)
show_epic(:json)
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('entities/epic', dir: 'ee')
end
......@@ -293,7 +293,7 @@ describe Groups::EpicsController do
it 'returns a not found 404 response' do
show_epic(:json)
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json'
end
end
......@@ -384,7 +384,7 @@ describe Groups::EpicsController do
it 'returns a not found 404 response' do
subject
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -409,7 +409,7 @@ describe Groups::EpicsController do
it 'returns 200 response' do
subject
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'creates a new epic' do
......@@ -435,7 +435,7 @@ describe Groups::EpicsController do
end
it 'returns 422 response' do
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it 'does not create a new epic' do
......@@ -449,7 +449,7 @@ describe Groups::EpicsController do
group.add_guest(user)
subject
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -463,14 +463,14 @@ describe Groups::EpicsController do
group.add_developer(user)
delete :destroy, params: { group_id: group, id: epic.to_param, destroy_confirm: true }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it "deletes the epic" do
group.add_owner(user)
delete :destroy, params: { group_id: group, id: epic.to_param, destroy_confirm: true }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to(/The epic was successfully deleted\./)
end
end
......
......@@ -72,7 +72,7 @@ describe Groups::GroupMembersController do
},
format: :js
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -88,7 +88,7 @@ describe GroupsController do
it 'prevents access to group resources' do
get :show, params: { id: group }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to match(/groups\/#{group.to_param}\/-\/saml\/sso\?redirect=.+&token=/)
end
end
......@@ -103,7 +103,7 @@ describe GroupsController do
it 'allows access to group resources' do
get :show, params: { id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -20,7 +20,7 @@ describe Groups::HooksController do
it 'is successfull' do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -43,7 +43,7 @@ describe Groups::HooksController do
post :create, params: { group_id: group.to_param, hook: hook_params }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(group.hooks.size).to eq(1)
expect(group.hooks.first).to have_attributes(hook_params)
end
......@@ -55,7 +55,7 @@ describe Groups::HooksController do
it 'is successfull' do
get :edit, params: { group_id: group.to_param, id: hook }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit)
expect(group.hooks.size).to eq(1)
end
......@@ -85,7 +85,7 @@ describe Groups::HooksController do
it 'is successfull' do
patch :update, params: { group_id: group.to_param, id: hook, hook: hook_params }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(group_hooks_path(group))
expect(group.hooks.size).to eq(1)
expect(group.hooks.first).to have_attributes(hook_params)
......@@ -102,7 +102,7 @@ describe Groups::HooksController do
it 'renders "edit" template' do
patch :update, params: { group_id: group.to_param, id: hook, hook: hook_params }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit)
expect(group.hooks.size).to eq(1)
expect(group.hooks.first).not_to have_attributes(hook_params)
......@@ -119,7 +119,7 @@ describe Groups::HooksController do
post :test, params: { group_id: group.to_param, id: hook }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(flash[:alert]).to eq('Hook execution failed. Ensure the group has a project with commits.')
end
end
......@@ -135,7 +135,7 @@ describe Groups::HooksController do
post :test, params: { group_id: group.to_param, id: hook }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(flash[:notice]).to eq('Hook executed successfully: HTTP 200')
end
end
......@@ -150,7 +150,7 @@ describe Groups::HooksController do
post :test, params: { group_id: group.to_param, id: hook, trigger: trigger }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(flash[:notice]).to eq('Hook executed successfully: HTTP 200')
end
end
......@@ -167,7 +167,7 @@ describe Groups::HooksController do
it 'renders a 404' do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -23,7 +23,7 @@ describe Groups::InsightsController do
it 'returns 404 status' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -31,7 +31,7 @@ describe Groups::InsightsController do
it 'returns 200 status' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -18,7 +18,7 @@ describe Groups::IssuesAnalyticsController do
it 'renders 404' do
get :show, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -32,7 +32,7 @@ describe Groups::IssuesAnalyticsController do
it 'renders 404' do
get :show, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -31,7 +31,7 @@ describe Groups::IssuesController do
it 'returns 404 status' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -35,7 +35,7 @@ describe Groups::MergeRequestsController do
it 'returns 404 status' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -22,7 +22,7 @@ describe Groups::SamlProvidersController do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -110,7 +110,7 @@ describe Groups::SamlProvidersController do
subject
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -23,17 +23,17 @@ describe Groups::Security::DashboardController do
group.add_developer(user)
end
it { is_expected.to have_gitlab_http_status(200) }
it { is_expected.to have_gitlab_http_status(:ok) }
end
context 'when user is not allowed to access group security dashboard' do
it { is_expected.to have_gitlab_http_status(200) }
it { is_expected.to have_gitlab_http_status(:ok) }
it { is_expected.to render_template(:unavailable) }
end
end
context 'when security dashboard feature is disabled' do
it { is_expected.to have_gitlab_http_status(200) }
it { is_expected.to have_gitlab_http_status(:ok) }
it { is_expected.to render_template(:unavailable) }
end
end
......
......@@ -90,7 +90,7 @@ describe Groups::Security::VulnerabilityFindingsController do
subject
end
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['total']).to eq({ '2018-11-12' => 2 })
expect(json_response['critical']).to eq({ '2018-11-12' => 1 })
expect(json_response['low']).to eq({ '2018-11-12' => 1 })
......
......@@ -36,7 +36,7 @@ describe Groups::Security::VulnerableProjectsController do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.count).to be(1)
expect(json_response.first['id']).to eq(vulnerable_project.id)
expect(json_response.first['full_path']).to eq(project_path(vulnerable_project))
......@@ -53,7 +53,7 @@ describe Groups::Security::VulnerableProjectsController do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
......
......@@ -18,13 +18,13 @@ describe Groups::SsoController do
it 'has status 200' do
get :saml, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'malicious redirect parameter falls back to group_path' do
get :saml, params: { group_id: group, redirect: '///malicious-url' }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns[:redirect_path]).to eq(group_path(group))
end
......@@ -50,7 +50,7 @@ describe Groups::SsoController do
it 'renders 404' do
get :saml, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'still allows account unlinking' do
......@@ -88,7 +88,7 @@ describe Groups::SsoController do
it 'renders 404' do
get :saml, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -115,7 +115,7 @@ describe Groups::SsoController do
it 'renders 404' do
get :saml, params: { group_id: 'not-a-group' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'when user is not signed in' do
......@@ -147,7 +147,7 @@ describe Groups::SsoController do
let(:oauth_data) { { "info" => { name: 'Test', email: 'testuser@email.com' } } }
it 'has status 200' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
end
it 'suggests first available username automatically' do
......@@ -162,13 +162,13 @@ describe Groups::SsoController do
let(:oauth_group_id) { group.id + 1 }
it 'renders 404' do
expect(subject).to have_gitlab_http_status(404)
expect(subject).to have_gitlab_http_status(:not_found)
end
end
end
it 'renders 404' do
expect(subject).to have_gitlab_http_status(404)
expect(subject).to have_gitlab_http_status(:not_found)
end
end
......@@ -178,7 +178,7 @@ describe Groups::SsoController do
end
it 'renders 404' do
expect(subject).to have_gitlab_http_status(404)
expect(subject).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -25,6 +25,6 @@ describe Groups::AvatarsController do
delete :destroy, params: { group_id: group }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -33,7 +33,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do
list_boards
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html'
end
end
......@@ -76,7 +76,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do
list_boards format: :json
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json'
end
end
......@@ -111,7 +111,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do
read_board board: board
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html'
end
end
......@@ -148,7 +148,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do
read_board board: board, format: :json
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json'
end
end
......@@ -160,7 +160,7 @@ describe Groups::BoardsController do
read_board board: another_board
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -142,7 +142,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns an array with one element when only one result is matched' do
......@@ -185,7 +185,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 3 }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'includes pagination headers' do
......@@ -316,7 +316,7 @@ describe Groups::ChildrenController do
it 'correctly calculates the counts' do
get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -328,7 +328,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -43,7 +43,7 @@ describe Groups::Clusters::ApplicationsController do
expect(ClusterInstallAppWorker).to receive(:perform_async).with(application, anything).once
expect { subject }.to change { current_application.count }
expect(response).to have_http_status(:no_content)
expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.application_helm).to be_scheduled
end
......@@ -54,7 +54,7 @@ describe Groups::Clusters::ApplicationsController do
it 'return 404' do
expect { subject }.not_to change { current_application.count }
expect(response).to have_http_status(:not_found)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -62,7 +62,7 @@ describe Groups::Clusters::ApplicationsController do
let(:application) { 'unkwnown-app' }
it 'return 404' do
is_expected.to have_http_status(:not_found)
is_expected.to have_gitlab_http_status(:not_found)
end
end
......@@ -72,7 +72,7 @@ describe Groups::Clusters::ApplicationsController do
end
it 'returns 400' do
is_expected.to have_http_status(:bad_request)
is_expected.to have_gitlab_http_status(:bad_request)
end
end
end
......@@ -107,7 +107,7 @@ describe Groups::Clusters::ApplicationsController do
it "schedules an application update" do
expect(ClusterPatchAppWorker).to receive(:perform_async).with(application.name, anything).once
is_expected.to have_http_status(:no_content)
is_expected.to have_gitlab_http_status(:no_content)
expect(cluster.application_cert_manager).to be_scheduled
end
......@@ -118,13 +118,13 @@ describe Groups::Clusters::ApplicationsController do
cluster.destroy!
end
it { is_expected.to have_http_status(:not_found) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when application is unknown' do
let(:application_name) { 'unkwnown-app' }
it { is_expected.to have_http_status(:not_found) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when application is already scheduled' do
......@@ -132,7 +132,7 @@ describe Groups::Clusters::ApplicationsController do
application.make_scheduled!
end
it { is_expected.to have_http_status(:bad_request) }
it { is_expected.to have_gitlab_http_status(:bad_request) }
end
end
......
......@@ -654,7 +654,7 @@ describe Groups::ClustersController do
go(format: :json)
cluster.reload
expect(response).to have_http_status(:no_content)
expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.enabled).to be_falsey
expect(cluster.name).to eq('my-new-cluster-name')
expect(cluster).not_to be_managed
......@@ -674,7 +674,7 @@ describe Groups::ClustersController do
it 'rejects changes' do
go(format: :json)
expect(response).to have_http_status(:bad_request)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
......
......@@ -100,7 +100,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -113,7 +113,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -126,7 +126,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -168,7 +168,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -180,7 +180,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -210,7 +210,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -222,7 +222,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -13,7 +13,7 @@ describe Groups::GroupMembersController do
it 'renders index with 200 status code' do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
......@@ -105,7 +105,7 @@ describe Groups::GroupMembersController do
access_level: Gitlab::Access::GUEST
}
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(group.users).not_to include group_user
end
end
......@@ -173,7 +173,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do
delete :destroy, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -186,7 +186,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do
delete :destroy, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(group.members).to include member
end
end
......@@ -223,7 +223,7 @@ describe Groups::GroupMembersController do
it 'returns 404' do
delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -244,7 +244,7 @@ describe Groups::GroupMembersController do
it 'supports json request' do
delete :leave, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
end
end
......@@ -257,7 +257,7 @@ describe Groups::GroupMembersController do
it 'cannot removes himself from the group' do
delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -304,7 +304,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do
post :approve_access_request, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -317,7 +317,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do
post :approve_access_request, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(group.members).not_to include member
end
end
......@@ -348,7 +348,7 @@ describe Groups::GroupMembersController do
it 'is successful' do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -356,7 +356,7 @@ describe Groups::GroupMembersController do
it 'is successful' do
post :create, params: { group_id: group, users: user, access_level: Gitlab::Access::GUEST }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -370,7 +370,7 @@ describe Groups::GroupMembersController do
},
format: :js
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -378,7 +378,7 @@ describe Groups::GroupMembersController do
it 'is successful' do
delete :destroy, params: { group_id: group, id: membership }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -388,7 +388,7 @@ describe Groups::GroupMembersController do
post :request_access, params: { group_id: group }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -397,7 +397,7 @@ describe Groups::GroupMembersController do
access_request = create(:group_member, :access_request, group: group)
post :approve_access_request, params: { group_id: group, id: access_request }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -407,7 +407,7 @@ describe Groups::GroupMembersController do
delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -415,7 +415,7 @@ describe Groups::GroupMembersController do
it 'is successful' do
post :resend_invite, params: { group_id: group, id: membership }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......
......@@ -53,7 +53,7 @@ describe Groups::LabelsController do
post :toggle_subscription, params: { group_id: group.to_param, id: label.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -42,7 +42,7 @@ describe Groups::MilestonesController do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(milestone.title)
end
......@@ -74,7 +74,7 @@ describe Groups::MilestonesController do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(milestone.title)
end
end
......@@ -84,7 +84,7 @@ describe Groups::MilestonesController do
it 'does not return milestone' do
get :index, params: { group_id: public_group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to include(private_milestone.title)
end
end
......@@ -125,7 +125,7 @@ describe Groups::MilestonesController do
it 'returns the milestone' do
get :index, params: { group_id: public_group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(private_milestone.title)
end
end
......@@ -141,7 +141,7 @@ describe Groups::MilestonesController do
it 'shows subgroup milestones that user has access to' do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(group_milestone.title)
expect(response.body).to include(sub_project_milestone.title)
expect(response.body).to include(subgroup_milestone.title)
......@@ -157,7 +157,7 @@ describe Groups::MilestonesController do
it 'does not show subgroup milestones' do
get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(group_milestone.title)
expect(response.body).not_to include(sub_project_milestone.title)
expect(response.body).not_to include(subgroup_milestone.title)
......@@ -179,7 +179,7 @@ describe Groups::MilestonesController do
expect(milestones.count).to eq(2)
expect(milestones.first["title"]).to eq("group milestone")
expect(milestones.second["title"]).to eq("legacy")
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json'
end
......@@ -330,7 +330,7 @@ describe Groups::MilestonesController do
it 'does not redirect' do
get :index, params: { group_id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -349,7 +349,7 @@ describe Groups::MilestonesController do
it 'does not redirect' do
get :show, params: { group_id: group.to_param, id: title }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -439,7 +439,7 @@ describe Groups::MilestonesController do
milestone: { title: title }
}
expect(response).not_to have_gitlab_http_status(404)
expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
......@@ -449,7 +449,7 @@ describe Groups::MilestonesController do
milestone: { title: title }
}
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -463,7 +463,7 @@ describe Groups::MilestonesController do
milestone: { title: title }
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -21,7 +21,7 @@ describe Groups::RunnersController do
it 'renders show with 200 status code' do
get :show, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show)
end
end
......@@ -34,7 +34,7 @@ describe Groups::RunnersController do
it 'renders a 404' do
get :show, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -48,7 +48,7 @@ describe Groups::RunnersController do
it 'renders show with 200 status code' do
get :edit, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit)
end
end
......@@ -61,7 +61,7 @@ describe Groups::RunnersController do
it 'renders a 404' do
get :edit, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -79,7 +79,7 @@ describe Groups::RunnersController do
post :update, params: params.merge(runner: { description: new_desc } )
end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.description).to eq(new_desc)
end
end
......@@ -96,7 +96,7 @@ describe Groups::RunnersController do
post :update, params: params.merge(runner: { description: old_desc.swapcase } )
end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.description).to eq(old_desc)
end
end
......@@ -111,7 +111,7 @@ describe Groups::RunnersController do
it 'destroys the runner and redirects' do
delete :destroy, params: params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
end
end
......@@ -124,7 +124,7 @@ describe Groups::RunnersController do
it 'responds 404 and does not destroy the runner' do
delete :destroy, params: params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(Ci::Runner.find_by(id: runner.id)).to be_present
end
end
......@@ -143,7 +143,7 @@ describe Groups::RunnersController do
post :resume, params: params
end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.active).to eq(true)
end
end
......@@ -160,7 +160,7 @@ describe Groups::RunnersController do
post :resume, params: params
end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.active).to eq(false)
end
end
......@@ -179,7 +179,7 @@ describe Groups::RunnersController do
post :pause, params: params
end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.active).to eq(false)
end
end
......@@ -196,7 +196,7 @@ describe Groups::RunnersController do
post :pause, params: params
end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.active).to eq(true)
end
end
......
......@@ -21,7 +21,7 @@ describe Groups::Settings::CiCdController do
it 'renders show with 200 status code' do
get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show)
end
end
......@@ -34,7 +34,7 @@ describe Groups::Settings::CiCdController do
it 'renders a 404' do
get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -47,7 +47,7 @@ describe Groups::Settings::CiCdController do
it 'renders show with 200 status code' do
get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -79,7 +79,7 @@ describe Groups::Settings::CiCdController do
it 'renders a 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -99,7 +99,7 @@ describe Groups::Settings::CiCdController do
group.add_maintainer(user)
end
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when user has enough privileges' do
......@@ -170,7 +170,7 @@ describe Groups::Settings::CiCdController do
group.add_owner(user)
end
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when user is an admin' do
......
......@@ -50,7 +50,7 @@ describe Groups::VariablesController do
it 'is successful' do
get :show, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -66,7 +66,7 @@ describe Groups::VariablesController do
},
format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
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