Commit 863331fe authored by Michael Kozono's avatar Michael Kozono

Merge branch 'issue#220040-fix-rails-savebang-requests-spec' into 'master'

Fix Rails/SaveBang Rubocop offenses for requests module

See merge request gitlab-org/gitlab!57883
parents 07896a07 a4b7db35
......@@ -354,8 +354,6 @@ Rails/SaveBang:
- 'spec/requests/api/jobs_spec.rb'
- 'spec/requests/api/labels_spec.rb'
- 'spec/requests/api/project_import_spec.rb'
- 'spec/requests/projects/cycle_analytics_events_spec.rb'
- 'spec/requests/users_controller_spec.rb'
Rails/TimeZone:
Enabled: true
......
---
title: Fix Rails/SaveBang Rubocop offenses for requests module
merge_request: 57883
author: Huzaifa Iftikhar @huzaifaiftikhar
type: fixed
......@@ -75,7 +75,7 @@ RSpec.describe 'value stream analytics events' do
context 'with private project and builds' do
before do
project.members.last.update(access_level: Gitlab::Access::GUEST)
project.members.last.update!(access_level: Gitlab::Access::GUEST)
end
it 'does not list the test events' do
......@@ -100,7 +100,7 @@ RSpec.describe 'value stream analytics events' do
def create_cycle
milestone = create(:milestone, project: project)
issue.update(milestone: milestone)
issue.update!(milestone: milestone)
mr = create_merge_request_closing_issue(user, project, issue, commit_message: "References #{issue.to_reference}")
pipeline = create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr)
......
......@@ -663,7 +663,7 @@ RSpec.describe UsersController do
end
context 'when a user changed their username' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-username') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'old-username') }
it 'returns JSON indicating a user by that username does not exist' do
get user_exists_url 'old-username'
......@@ -705,7 +705,7 @@ RSpec.describe UsersController do
end
context 'when a user changed their username' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-username') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'old-username') }
it 'returns JSON indicating a user by that username does not exist' do
get user_suggests_url 'old-username'
......@@ -755,19 +755,19 @@ RSpec.describe UsersController do
end
context 'when requesting a redirected path' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'old-path') }
it_behaves_like 'redirects to the canonical path'
context 'when the old path is a substring of the scheme or host' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'http') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'http') }
# it does not modify the requested host and ...
it_behaves_like 'redirects to the canonical path'
end
context 'when the old path is substring of users' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'ser') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'ser') }
it_behaves_like 'redirects to the canonical path'
end
......@@ -806,19 +806,19 @@ RSpec.describe UsersController do
end
context 'when requesting a redirected path' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-path') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'old-path') }
it_behaves_like 'redirects to the canonical path'
context 'when the old path is a substring of the scheme or host' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'http') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'http') }
# it does not modify the requested host and ...
it_behaves_like 'redirects to the canonical path'
end
context 'when the old path is substring of users' do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'ser') }
let(:redirect_route) { user.namespace.redirect_routes.create!(path: 'ser') }
# it does not modify the /users part of the path
# (i.e. /users/ser should not become /ufoos/ser) and ...
......
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