Commit 6ebf9396 authored by Huzaifa Iftikhar's avatar Huzaifa Iftikhar

Fix Rails/SaveBang Rubocop offenses for requests module

parent fffdd5c4
...@@ -408,8 +408,6 @@ Rails/SaveBang: ...@@ -408,8 +408,6 @@ Rails/SaveBang:
- 'spec/requests/api/jobs_spec.rb' - 'spec/requests/api/jobs_spec.rb'
- 'spec/requests/api/labels_spec.rb' - 'spec/requests/api/labels_spec.rb'
- 'spec/requests/api/project_import_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: Rails/TimeZone:
Enabled: true Enabled: true
......
...@@ -75,7 +75,7 @@ RSpec.describe 'value stream analytics events' do ...@@ -75,7 +75,7 @@ RSpec.describe 'value stream analytics events' do
context 'with private project and builds' do context 'with private project and builds' do
before do before do
project.members.last.update(access_level: Gitlab::Access::GUEST) project.members.last.update!(access_level: Gitlab::Access::GUEST)
end end
it 'does not list the test events' do it 'does not list the test events' do
...@@ -100,7 +100,7 @@ RSpec.describe 'value stream analytics events' do ...@@ -100,7 +100,7 @@ RSpec.describe 'value stream analytics events' do
def create_cycle def create_cycle
milestone = create(:milestone, project: project) 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}") 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) 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 ...@@ -663,7 +663,7 @@ RSpec.describe UsersController do
end end
context 'when a user changed their username' do 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 it 'returns JSON indicating a user by that username does not exist' do
get user_exists_url 'old-username' get user_exists_url 'old-username'
...@@ -705,7 +705,7 @@ RSpec.describe UsersController do ...@@ -705,7 +705,7 @@ RSpec.describe UsersController do
end end
context 'when a user changed their username' do 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 it 'returns JSON indicating a user by that username does not exist' do
get user_suggests_url 'old-username' get user_suggests_url 'old-username'
...@@ -755,19 +755,19 @@ RSpec.describe UsersController do ...@@ -755,19 +755,19 @@ RSpec.describe UsersController do
end end
context 'when requesting a redirected path' do 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' it_behaves_like 'redirects to the canonical path'
context 'when the old path is a substring of the scheme or host' do 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 does not modify the requested host and ...
it_behaves_like 'redirects to the canonical path' it_behaves_like 'redirects to the canonical path'
end end
context 'when the old path is substring of users' do 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' it_behaves_like 'redirects to the canonical path'
end end
...@@ -806,19 +806,19 @@ RSpec.describe UsersController do ...@@ -806,19 +806,19 @@ RSpec.describe UsersController do
end end
context 'when requesting a redirected path' do 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' it_behaves_like 'redirects to the canonical path'
context 'when the old path is a substring of the scheme or host' do 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 does not modify the requested host and ...
it_behaves_like 'redirects to the canonical path' it_behaves_like 'redirects to the canonical path'
end end
context 'when the old path is substring of users' do 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 # it does not modify the /users part of the path
# (i.e. /users/ser should not become /ufoos/ser) and ... # (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