From 0953f72d87b08f51bc19dc31403f9bf97e3dfa2d Mon Sep 17 00:00:00 2001
From: Abdul Wadood <abdulwd97@gmail.com>
Date: Wed, 14 Apr 2021 14:04:36 +0000
Subject: [PATCH] Fix Rails/SaveBang offenses in ee/spec/models/geo

---
 .rubocop_manual_todo.yml                                  | 3 ---
 .../unreleased/rails-save-bang-ee-spec-models-geo.yml     | 5 +++++
 ee/spec/models/geo/project_registry_spec.rb               | 8 ++++----
 ee/spec/models/geo_node_spec.rb                           | 6 +++---
 4 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 ee/changelogs/unreleased/rails-save-bang-ee-spec-models-geo.yml

diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml
index 2b825950eabbc..8dd5c364c75b6 100644
--- a/.rubocop_manual_todo.yml
+++ b/.rubocop_manual_todo.yml
@@ -75,9 +75,6 @@ Rails/SaveBang:
     - 'ee/spec/models/elasticsearch_indexed_namespace_spec.rb'
     - 'ee/spec/models/environment_spec.rb'
     - 'ee/spec/models/epic_spec.rb'
-    - 'ee/spec/models/geo/project_registry_spec.rb'
-    - 'ee/spec/models/geo_node_spec.rb'
-    - 'ee/spec/models/geo_node_status_spec.rb'
     - 'ee/spec/models/gitlab_subscription_spec.rb'
     - 'ee/spec/models/issue_spec.rb'
     - 'ee/spec/models/label_note_spec.rb'
diff --git a/ee/changelogs/unreleased/rails-save-bang-ee-spec-models-geo.yml b/ee/changelogs/unreleased/rails-save-bang-ee-spec-models-geo.yml
new file mode 100644
index 0000000000000..2bd36655b4e49
--- /dev/null
+++ b/ee/changelogs/unreleased/rails-save-bang-ee-spec-models-geo.yml
@@ -0,0 +1,5 @@
+---
+title: Fix Rails/SaveBang rubocop offenses in ee/spec/models/
+merge_request: 58115
+author: Abdul Wadood @abdulwd
+type: fixed
diff --git a/ee/spec/models/geo/project_registry_spec.rb b/ee/spec/models/geo/project_registry_spec.rb
index 00397a1a3eeb3..652605a9ac18a 100644
--- a/ee/spec/models/geo/project_registry_spec.rb
+++ b/ee/spec/models/geo/project_registry_spec.rb
@@ -797,7 +797,7 @@
       end
 
       it 'sets repository_retry_at to a future time' do
-        subject.update(repository_retry_count: 0)
+        subject.update!(repository_retry_count: 0)
 
         subject.fail_sync!(type, message, error)
 
@@ -805,7 +805,7 @@
       end
 
       it 'ensures repository_retry_at is capped at one hour' do
-        subject.update(repository_retry_count: 31)
+        subject.update!(repository_retry_count: 31)
 
         subject.fail_sync!(type, message, error)
 
@@ -882,7 +882,7 @@
       end
 
       it 'sets wiki_retry_at to a future time' do
-        subject.update(wiki_retry_count: 0)
+        subject.update!(wiki_retry_count: 0)
 
         subject.fail_sync!(type, message, error)
 
@@ -890,7 +890,7 @@
       end
 
       it 'ensures wiki_retry_at is capped at one hour' do
-        subject.update(wiki_retry_count: 31)
+        subject.update!(wiki_retry_count: 31)
 
         subject.fail_sync!(type, message, error)
 
diff --git a/ee/spec/models/geo_node_spec.rb b/ee/spec/models/geo_node_spec.rb
index f1688a38a4b42..7d808d11186dd 100644
--- a/ee/spec/models/geo_node_spec.rb
+++ b/ee/spec/models/geo_node_spec.rb
@@ -148,7 +148,7 @@
 
         context 'when the oauth_application is missing' do
           before do
-            node.oauth_application.destroy
+            node.oauth_application.destroy!
             node.oauth_application = nil
           end
 
@@ -255,7 +255,7 @@
     it 'expires cache when removed' do
       expect(node).to receive(:expire_cache!) # 1 for creation 1 for deletion
 
-      node.destroy
+      node.destroy!
     end
   end
 
@@ -596,7 +596,7 @@
 
       expect(status).to be_a(GeoNodeStatus)
 
-      status.save
+      status.save!
 
       expect(new_node.find_or_build_status).to eq(status)
     end
-- 
GitLab