From 80a73b15636f2a66cc5bfc850852b7033875bf00 Mon Sep 17 00:00:00 2001
From: Abdul Wadood <abdulwd97@gmail.com>
Date: Wed, 31 Mar 2021 15:33:47 +0000
Subject: [PATCH] Fix Rails/SaveBang offenses in ee/spec/models/ci

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/220040.
---
 .rubocop_manual_todo.yml                        |  2 --
 ee/spec/models/ci/pipeline_spec.rb              | 10 +++++-----
 ee/spec/models/ci/subscriptions/project_spec.rb |  2 +-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml
index ff042f763a0..a7c93bd161e 100644
--- a/.rubocop_manual_todo.yml
+++ b/.rubocop_manual_todo.yml
@@ -67,8 +67,6 @@ Rails/SaveBang:
     - 'ee/spec/models/approval_merge_request_rule_spec.rb'
     - 'ee/spec/models/approval_project_rule_spec.rb'
     - 'ee/spec/models/burndown_spec.rb'
-    - 'ee/spec/models/ci/pipeline_spec.rb'
-    - 'ee/spec/models/ci/subscriptions/project_spec.rb'
     - 'ee/spec/models/ee/appearance_spec.rb'
     - 'ee/spec/models/ee/ci/job_artifact_spec.rb'
     - 'ee/spec/models/ee/protected_branch_spec.rb'
diff --git a/ee/spec/models/ci/pipeline_spec.rb b/ee/spec/models/ci/pipeline_spec.rb
index 41b4b82c89a..415bc7e43c5 100644
--- a/ee/spec/models/ci/pipeline_spec.rb
+++ b/ee/spec/models/ci/pipeline_spec.rb
@@ -266,8 +266,8 @@ RSpec.describe Ci::Pipeline do
 
       context 'when builds are retried' do
         before do
-          build_1.update(retried: true)
-          build_2.update(retried: true)
+          build_1.update!(retried: true)
+          build_2.update!(retried: true)
         end
 
         it 'does not take retried builds into account' do
@@ -305,8 +305,8 @@ RSpec.describe Ci::Pipeline do
 
       context 'when builds are retried' do
         before do
-          build.update(retried: true)
-          build1.update(retried: true)
+          build.update!(retried: true)
+          build1.update!(retried: true)
         end
 
         it 'does not take retried builds into account' do
@@ -388,7 +388,7 @@ RSpec.describe Ci::Pipeline do
 
       context 'when pipeline runs on a tag' do
         before do
-          pipeline.update(tag: true)
+          pipeline.update!(tag: true)
         end
 
         context 'when feature is not available' do
diff --git a/ee/spec/models/ci/subscriptions/project_spec.rb b/ee/spec/models/ci/subscriptions/project_spec.rb
index 77e61a37bec..46eab78a7f1 100644
--- a/ee/spec/models/ci/subscriptions/project_spec.rb
+++ b/ee/spec/models/ci/subscriptions/project_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe Ci::Subscriptions::Project do
     it { is_expected.to validate_uniqueness_of(:upstream_project_id).scoped_to(:downstream_project_id) }
 
     it 'validates that upstream project is public' do
-      upstream_project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+      upstream_project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
 
       expect(subscription).not_to be_valid
     end
-- 
2.30.9