Commit b80741c8 authored by Abdul Wadood's avatar Abdul Wadood

Fix Rails/SaveBang offenses for spec/controllers/groups

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