Skip to content
Snippets Groups Projects
Commit b80741c8 authored by Abdul Wadood's avatar Abdul Wadood
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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'
Loading
Loading
Loading
Loading
@@ -322,7 +322,7 @@
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 }
Loading
Loading
@@ -350,7 +350,7 @@
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 }
Loading
Loading
@@ -362,7 +362,7 @@
 
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 }
Loading
Loading
@@ -374,7 +374,7 @@
 
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 }
Loading
Loading
@@ -411,7 +411,7 @@
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,
Loading
Loading
Loading
Loading
@@ -220,7 +220,7 @@
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
Loading
Loading
@@ -231,7 +231,7 @@
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
Loading
Loading
@@ -248,7 +248,7 @@
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
Loading
Loading
@@ -259,7 +259,7 @@
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
Loading
Loading
@@ -278,7 +278,7 @@
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
Loading
Loading
@@ -289,7 +289,7 @@
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
Loading
Loading
@@ -306,7 +306,7 @@
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
Loading
Loading
@@ -317,7 +317,7 @@
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
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@
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
Loading
Loading
Loading
Loading
@@ -636,7 +636,7 @@
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
Loading
Loading
@@ -645,7 +645,7 @@
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)
Loading
Loading
@@ -655,7 +655,7 @@
 
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)
Loading
Loading
@@ -707,7 +707,7 @@
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 }
Loading
Loading
@@ -717,7 +717,7 @@
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 }
Loading
Loading
@@ -729,7 +729,7 @@
 
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 }
Loading
Loading
@@ -741,7 +741,7 @@
 
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 }
Loading
Loading
@@ -769,7 +769,7 @@
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' } }
Loading
Loading
@@ -795,7 +795,7 @@
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 }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment