Commit 0c6c4497 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Fix Rails/SaveBang offenses

Fixes Rails/SaveBang cop for spec files
parent b720d175
...@@ -1154,9 +1154,6 @@ Rails/SaveBang: ...@@ -1154,9 +1154,6 @@ Rails/SaveBang:
- 'spec/requests/api/notes_spec.rb' - 'spec/requests/api/notes_spec.rb'
- 'spec/requests/api/pipeline_schedules_spec.rb' - 'spec/requests/api/pipeline_schedules_spec.rb'
- 'spec/requests/api/project_import_spec.rb' - 'spec/requests/api/project_import_spec.rb'
- 'spec/requests/api/project_milestones_spec.rb'
- 'spec/requests/api/projects_spec.rb'
- 'spec/requests/api/snippets_spec.rb'
- 'spec/requests/git_http_spec.rb' - 'spec/requests/git_http_spec.rb'
- 'spec/requests/lfs_http_spec.rb' - 'spec/requests/lfs_http_spec.rb'
- 'spec/requests/profiles/notifications_controller_spec.rb' - 'spec/requests/profiles/notifications_controller_spec.rb'
......
---
title: Fix Rails/SaveBang offenses for 3 files
merge_request: 41394
author: Rajendra Kadam
type: other
...@@ -43,7 +43,7 @@ RSpec.describe API::ProjectMilestones do ...@@ -43,7 +43,7 @@ RSpec.describe API::ProjectMilestones do
let(:milestones) { [group_milestone, ancestor_group_milestone, milestone, closed_milestone] } let(:milestones) { [group_milestone, ancestor_group_milestone, milestone, closed_milestone] }
before_all do before_all do
project.update(namespace: group) project.update!(namespace: group)
end end
it_behaves_like 'listing all milestones' it_behaves_like 'listing all milestones'
...@@ -108,7 +108,7 @@ RSpec.describe API::ProjectMilestones do ...@@ -108,7 +108,7 @@ RSpec.describe API::ProjectMilestones do
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
project.update(namespace: group) project.update!(namespace: group)
end end
context 'when user does not have permission to promote milestone' do context 'when user does not have permission to promote milestone' do
...@@ -163,7 +163,7 @@ RSpec.describe API::ProjectMilestones do ...@@ -163,7 +163,7 @@ RSpec.describe API::ProjectMilestones do
context 'when project does not belong to group' do context 'when project does not belong to group' do
before do before do
project.update(namespace: user.namespace) project.update!(namespace: user.namespace)
end end
it 'returns 403' do it 'returns 403' do
......
...@@ -208,7 +208,7 @@ RSpec.describe API::Projects do ...@@ -208,7 +208,7 @@ RSpec.describe API::Projects do
end end
it 'does not include projects marked for deletion' do it 'does not include projects marked for deletion' do
project.update(pending_delete: true) project.update!(pending_delete: true)
get api('/projects', user) get api('/projects', user)
...@@ -502,7 +502,7 @@ RSpec.describe API::Projects do ...@@ -502,7 +502,7 @@ RSpec.describe API::Projects do
before do before do
project_member project_member
user3.update(starred_projects: [project, project2, project3, public_project]) user3.update!(starred_projects: [project, project2, project3, public_project])
end end
it 'returns the starred projects viewable by the user' do it 'returns the starred projects viewable by the user' do
...@@ -523,7 +523,7 @@ RSpec.describe API::Projects do ...@@ -523,7 +523,7 @@ RSpec.describe API::Projects do
let!(:project9) { create(:project, :public, path: 'gitlab9') } let!(:project9) { create(:project, :public, path: 'gitlab9') }
before do before do
user.update(starred_projects: [project5, project7, project8, project9]) user.update!(starred_projects: [project5, project7, project8, project9])
end end
context 'including owned filter' do context 'including owned filter' do
...@@ -1232,7 +1232,7 @@ RSpec.describe API::Projects do ...@@ -1232,7 +1232,7 @@ RSpec.describe API::Projects do
describe 'GET /users/:user_id/starred_projects/' do describe 'GET /users/:user_id/starred_projects/' do
before do before do
user3.update(starred_projects: [project, project2, project3]) user3.update!(starred_projects: [project, project2, project3])
end end
it 'returns error when user not found' do it 'returns error when user not found' do
...@@ -1745,7 +1745,7 @@ RSpec.describe API::Projects do ...@@ -1745,7 +1745,7 @@ RSpec.describe API::Projects do
end end
it 'returns 404 when project is marked for deletion' do it 'returns 404 when project is marked for deletion' do
project.update(pending_delete: true) project.update!(pending_delete: true)
get api("/projects/#{project.id}", user) get api("/projects/#{project.id}", user)
...@@ -2260,7 +2260,7 @@ RSpec.describe API::Projects do ...@@ -2260,7 +2260,7 @@ RSpec.describe API::Projects do
end end
it "returns a 400 error when sharing is disabled" do it "returns a 400 error when sharing is disabled" do
project.namespace.update(share_with_group_lock: true) project.namespace.update!(share_with_group_lock: true)
post api("/projects/#{project.id}/share", user), params: { group_id: group.id, group_access: Gitlab::Access::DEVELOPER } post api("/projects/#{project.id}/share", user), params: { group_id: group.id, group_access: Gitlab::Access::DEVELOPER }
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
end end
...@@ -2417,7 +2417,7 @@ RSpec.describe API::Projects do ...@@ -2417,7 +2417,7 @@ RSpec.describe API::Projects do
end end
it 'updates visibility_level from public to private' do it 'updates visibility_level from public to private' do
project3.update({ visibility_level: Gitlab::VisibilityLevel::PUBLIC }) project3.update!({ visibility_level: Gitlab::VisibilityLevel::PUBLIC })
project_param = { visibility: 'private' } project_param = { visibility: 'private' }
put api("/projects/#{project3.id}", user), params: project_param put api("/projects/#{project3.id}", user), params: project_param
...@@ -2877,8 +2877,8 @@ RSpec.describe API::Projects do ...@@ -2877,8 +2877,8 @@ RSpec.describe API::Projects do
let(:private_user) { create(:user, private_profile: true) } let(:private_user) { create(:user, private_profile: true) }
before do before do
user.update(starred_projects: [public_project]) user.update!(starred_projects: [public_project])
private_user.update(starred_projects: [public_project]) private_user.update!(starred_projects: [public_project])
end end
it 'returns not_found(404) for not existing project' do it 'returns not_found(404) for not existing project' do
......
...@@ -111,7 +111,7 @@ RSpec.describe API::Snippets do ...@@ -111,7 +111,7 @@ RSpec.describe API::Snippets do
end end
it 'returns 404 for invalid snippet id' do it 'returns 404 for invalid snippet id' do
snippet.destroy snippet.destroy!
get api("/snippets/#{snippet.id}/raw", author) get api("/snippets/#{snippet.id}/raw", author)
...@@ -201,7 +201,7 @@ RSpec.describe API::Snippets do ...@@ -201,7 +201,7 @@ RSpec.describe API::Snippets do
end end
it 'returns 404 for invalid snippet id' do it 'returns 404 for invalid snippet id' do
private_snippet.destroy private_snippet.destroy!
subject subject
......
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