Commit 143bbd46 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'rails-save-bang-groups-controllers' into 'master'

Fix Rails/SaveBang offenses for spec/controllers/groups

See merge request gitlab-org/gitlab!57879
parents 0e462768 d6931628
......@@ -174,10 +174,6 @@ Rails/SaveBang:
- 'qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_ssh_with_key_spec.rb'
- 'spec/controllers/abuse_reports_controller_spec.rb'
- 'spec/controllers/boards/issues_controller_spec.rb'
- 'spec/controllers/groups/milestones_controller_spec.rb'
- 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups/uploads_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/sent_notifications_controller_spec.rb'
- 'spec/controllers/sessions_controller_spec.rb'
- 'spec/factories_spec.rb'
......
---
title: Fix Rails/SaveBang rubocop offenses in spec/controllers/groups*
merge_request: 57879
author: Abdul Wadood @abdulwd
type: fixed
......@@ -322,7 +322,7 @@ RSpec.describe Groups::MilestonesController do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
it 'redirects to the canonical path' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }
......@@ -350,7 +350,7 @@ RSpec.describe Groups::MilestonesController do
end
context 'when the old group path is a substring of the scheme or host' do
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
let(:redirect_route) { group.redirect_routes.create!(path: 'http') }
it 'does not modify the requested host' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }
......@@ -362,7 +362,7 @@ RSpec.describe Groups::MilestonesController do
context 'when the old group path is substring of groups' do
# I.e. /groups/oups should not become /grfoo/oups
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
let(:redirect_route) { group.redirect_routes.create!(path: 'oups') }
it 'does not modify the /groups part of the path' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }
......@@ -374,7 +374,7 @@ RSpec.describe Groups::MilestonesController do
context 'when the old group path is substring of groups plus the new path' do
# I.e. /groups/oups/oup should not become /grfoos
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
let(:redirect_route) { group.redirect_routes.create!(path: 'oups/oup') }
it 'does not modify the /groups part of the path' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }
......@@ -411,7 +411,7 @@ RSpec.describe Groups::MilestonesController do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
it 'returns not found' do
post :create,
......
......@@ -220,7 +220,7 @@ RSpec.describe Groups::RunnersController do
end
it 'marks the runner as active, ticks the queue, and redirects' do
runner.update(active: false)
runner.update!(active: false)
expect do
post :resume, params: params
......@@ -231,7 +231,7 @@ RSpec.describe Groups::RunnersController do
end
it 'marks the project runner as active, ticks the queue, and redirects' do
runner_project.update(active: false)
runner_project.update!(active: false)
expect do
post :resume, params: params_runner_project
......@@ -248,7 +248,7 @@ RSpec.describe Groups::RunnersController do
end
it 'responds 404 and does not activate the runner' do
runner.update(active: false)
runner.update!(active: false)
expect do
post :resume, params: params
......@@ -259,7 +259,7 @@ RSpec.describe Groups::RunnersController do
end
it 'responds 404 and does not activate the project runner' do
runner_project.update(active: false)
runner_project.update!(active: false)
expect do
post :resume, params: params_runner_project
......@@ -278,7 +278,7 @@ RSpec.describe Groups::RunnersController do
end
it 'marks the runner as inactive, ticks the queue, and redirects' do
runner.update(active: true)
runner.update!(active: true)
expect do
post :pause, params: params
......@@ -289,7 +289,7 @@ RSpec.describe Groups::RunnersController do
end
it 'marks the project runner as inactive, ticks the queue, and redirects' do
runner_project.update(active: true)
runner_project.update!(active: true)
expect do
post :pause, params: params_runner_project
......@@ -306,7 +306,7 @@ RSpec.describe Groups::RunnersController do
end
it 'responds 404 and does not update the runner or queue' do
runner.update(active: true)
runner.update!(active: true)
expect do
post :pause, params: params
......@@ -317,7 +317,7 @@ RSpec.describe Groups::RunnersController do
end
it 'responds 404 and does not update the project runner or queue' do
runner_project.update(active: true)
runner_project.update!(active: true)
expect do
post :pause, params: params
......
......@@ -23,7 +23,7 @@ RSpec.describe Groups::UploadsController do
let!(:upload) { create(:upload, :issuable_upload, :with_file, model: model) }
let(:group) { model }
let(:old_path) { group.to_param + 'old' }
let!(:redirect_route) { model.redirect_routes.create(path: old_path) }
let!(:redirect_route) { model.redirect_routes.create!(path: old_path) }
let(:upload_path) { File.basename(upload.path) }
it 'redirects to a file with the proper extension' do
......
......@@ -636,7 +636,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
let(:group_full_path) { redirect_route.path }
it 'redirects to the canonical path' do
......@@ -645,7 +645,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when the old group path is a substring of the scheme or host' do
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
let(:redirect_route) { group.redirect_routes.create!(path: 'http') }
it 'does not modify the requested host' do
expect(response).to redirect_to(group)
......@@ -655,7 +655,7 @@ RSpec.describe GroupsController, factory_default: :keep do
context 'when the old group path is substring of groups' do
# I.e. /groups/oups should not become /grfoo/oups
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
let(:redirect_route) { group.redirect_routes.create!(path: 'oups') }
it 'does not modify the /groups part of the path' do
expect(response).to redirect_to(group)
......@@ -707,7 +707,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
it 'redirects to the canonical path' do
get :issues, params: { id: redirect_route.path }
......@@ -717,7 +717,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when the old group path is a substring of the scheme or host' do
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
let(:redirect_route) { group.redirect_routes.create!(path: 'http') }
it 'does not modify the requested host' do
get :issues, params: { id: redirect_route.path }
......@@ -729,7 +729,7 @@ RSpec.describe GroupsController, factory_default: :keep do
context 'when the old group path is substring of groups' do
# I.e. /groups/oups should not become /grfoo/oups
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
let(:redirect_route) { group.redirect_routes.create!(path: 'oups') }
it 'does not modify the /groups part of the path' do
get :issues, params: { id: redirect_route.path }
......@@ -741,7 +741,7 @@ RSpec.describe GroupsController, factory_default: :keep do
context 'when the old group path is substring of groups plus the new path' do
# I.e. /groups/oups/oup should not become /grfoos
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
let(:redirect_route) { group.redirect_routes.create!(path: 'oups/oup') }
it 'does not modify the /groups part of the path' do
get :issues, params: { id: redirect_route.path }
......@@ -769,7 +769,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
it 'returns not found' do
post :update, params: { id: redirect_route.path, group: { path: 'new_path' } }
......@@ -795,7 +795,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
it 'returns not found' do
delete :destroy, params: { id: redirect_route.path }
......
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