Commit 36e3537b authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rails-save-bang-31' into 'master'

Fix Rails/SaveBang offenses in 2 files of spec/requests/api/

See merge request gitlab-org/gitlab!41395
parents 3777d420 17cec627
...@@ -1132,9 +1132,6 @@ Rails/SaveBang: ...@@ -1132,9 +1132,6 @@ Rails/SaveBang:
- 'spec/requests/api/issues/post_projects_issues_spec.rb' - 'spec/requests/api/issues/post_projects_issues_spec.rb'
- '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/merge_requests_spec.rb'
- 'spec/requests/api/notes_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/projects/cycle_analytics_events_spec.rb' - 'spec/requests/projects/cycle_analytics_events_spec.rb'
- 'spec/services/auth/container_registry_authentication_service_spec.rb' - 'spec/services/auth/container_registry_authentication_service_spec.rb'
......
---
title: Fix Rails/SaveBang offenses for 3 files
merge_request: 41395
author: Rajendra Kadam
type: other
...@@ -912,7 +912,7 @@ RSpec.describe API::MergeRequests do ...@@ -912,7 +912,7 @@ RSpec.describe API::MergeRequests do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
before do before do
group.update(parent_id: parent_group.id) group.update!(parent_id: parent_group.id)
merge_request_merged.reload merge_request_merged.reload
end end
...@@ -1027,7 +1027,7 @@ RSpec.describe API::MergeRequests do ...@@ -1027,7 +1027,7 @@ RSpec.describe API::MergeRequests do
let(:non_member) { create(:user) } let(:non_member) { create(:user) }
before do before do
merge_request.update(author: non_member) merge_request.update!(author: non_member)
end end
it 'exposes first_contribution as true' do it 'exposes first_contribution as true' do
...@@ -1084,8 +1084,8 @@ RSpec.describe API::MergeRequests do ...@@ -1084,8 +1084,8 @@ RSpec.describe API::MergeRequests do
let(:merge_request) { create(:merge_request, :simple, author: user, source_project: project, source_branch: 'markdown', title: "Test") } let(:merge_request) { create(:merge_request, :simple, author: user, source_project: project, source_branch: 'markdown', title: "Test") }
before do before do
merge_request.update(head_pipeline: create(:ci_pipeline)) merge_request.update!(head_pipeline: create(:ci_pipeline))
merge_request.project.project_feature.update(builds_access_level: 10) merge_request.project.project_feature.update!(builds_access_level: 10)
end end
context 'when user can read the pipeline' do context 'when user can read the pipeline' do
...@@ -1691,7 +1691,7 @@ RSpec.describe API::MergeRequests do ...@@ -1691,7 +1691,7 @@ RSpec.describe API::MergeRequests do
end end
it 'returns 403 when target project has disabled merge requests' do it 'returns 403 when target project has disabled merge requests' do
project.project_feature.update(merge_requests_access_level: 0) project.project_feature.update!(merge_requests_access_level: 0)
post api("/projects/#{forked_project.id}/merge_requests", user2), post api("/projects/#{forked_project.id}/merge_requests", user2),
params: { params: {
...@@ -2146,7 +2146,7 @@ RSpec.describe API::MergeRequests do ...@@ -2146,7 +2146,7 @@ RSpec.describe API::MergeRequests do
let(:source_branch) { merge_request.source_branch } let(:source_branch) { merge_request.source_branch }
before do before do
merge_request.update(merge_params: { 'force_remove_source_branch' => true }) merge_request.update!(merge_params: { 'force_remove_source_branch' => true })
end end
it 'removes the source branch' do it 'removes the source branch' do
...@@ -2173,7 +2173,7 @@ RSpec.describe API::MergeRequests do ...@@ -2173,7 +2173,7 @@ RSpec.describe API::MergeRequests do
let(:merge_request) { create(:merge_request, :rebased, source_project: project, squash: true) } let(:merge_request) { create(:merge_request, :rebased, source_project: project, squash: true) }
before do before do
project.update(merge_requests_ff_only_enabled: true) project.update!(merge_requests_ff_only_enabled: true)
end end
it "records the squash commit SHA and returns it in the response" do it "records the squash commit SHA and returns it in the response" do
...@@ -2263,7 +2263,7 @@ RSpec.describe API::MergeRequests do ...@@ -2263,7 +2263,7 @@ RSpec.describe API::MergeRequests do
describe "PUT /projects/:id/merge_requests/:merge_request_iid" do describe "PUT /projects/:id/merge_requests/:merge_request_iid" do
context 'updates force_remove_source_branch properly' do context 'updates force_remove_source_branch properly' do
it 'sets to false' do it 'sets to false' do
merge_request.update(merge_params: { 'force_remove_source_branch' => true } ) merge_request.update!(merge_params: { 'force_remove_source_branch' => true } )
expect(merge_request.force_remove_source_branch?).to be_truthy expect(merge_request.force_remove_source_branch?).to be_truthy
...@@ -2275,7 +2275,7 @@ RSpec.describe API::MergeRequests do ...@@ -2275,7 +2275,7 @@ RSpec.describe API::MergeRequests do
end end
it 'sets to true' do it 'sets to true' do
merge_request.update(merge_params: { 'force_remove_source_branch' => false } ) merge_request.update!(merge_params: { 'force_remove_source_branch' => false } )
expect(merge_request.force_remove_source_branch?).to be_falsey expect(merge_request.force_remove_source_branch?).to be_falsey
...@@ -2760,7 +2760,7 @@ RSpec.describe API::MergeRequests do ...@@ -2760,7 +2760,7 @@ RSpec.describe API::MergeRequests do
merge_request merge_request
merge_request.created_at += 1.hour merge_request.created_at += 1.hour
merge_request.updated_at += 30.minutes merge_request.updated_at += 30.minutes
merge_request.save merge_request.save!
merge_request merge_request
end end
...@@ -2768,7 +2768,7 @@ RSpec.describe API::MergeRequests do ...@@ -2768,7 +2768,7 @@ RSpec.describe API::MergeRequests do
merge_request_closed merge_request_closed
merge_request_closed.created_at -= 1.hour merge_request_closed.created_at -= 1.hour
merge_request_closed.updated_at -= 30.minutes merge_request_closed.updated_at -= 30.minutes
merge_request_closed.save merge_request_closed.save!
merge_request_closed merge_request_closed
end end
end end
...@@ -81,7 +81,7 @@ RSpec.describe API::Notes do ...@@ -81,7 +81,7 @@ RSpec.describe API::Notes do
context "issue is confidential" do context "issue is confidential" do
before do before do
ext_issue.update(confidential: true) ext_issue.update!(confidential: true)
end end
it "returns 404" do it "returns 404" do
...@@ -183,7 +183,7 @@ RSpec.describe API::Notes do ...@@ -183,7 +183,7 @@ RSpec.describe API::Notes do
context "when issue is confidential" do context "when issue is confidential" do
before do before do
issue.update(confidential: true) issue.update!(confidential: true)
end end
it "returns 404" do it "returns 404" do
......
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