about summary refs log tree commit diff
path: root/spec/services/suspend_account_service_spec.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-01-05 13:47:21 +0100
committerGitHub <noreply@github.com>2023-01-05 13:47:21 +0100
commit18fb01ef7ca3829b07bb8ea101bdd073da72cfbc (patch)
tree5e493ef3997176e4a98be57ee68068d427176906 /spec/services/suspend_account_service_spec.rb
parent8683a082ddc04b2028b73a039325fd70fe3c55a9 (diff)
Fix possible race conditions when suspending/unsuspending accounts (#22363)
* Fix possible race conditions when suspending/unsuspending accounts

* Fix tests

Tests were assuming SuspensionWorker and UnsuspensionWorker would do the
suspending/unsuspending themselves, but this has changed.
Diffstat (limited to 'spec/services/suspend_account_service_spec.rb')
-rw-r--r--spec/services/suspend_account_service_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb
index 5d45e4ffd..126b13986 100644
--- a/spec/services/suspend_account_service_spec.rb
+++ b/spec/services/suspend_account_service_spec.rb
@@ -13,6 +13,8 @@ RSpec.describe SuspendAccountService, type: :service do
 
       local_follower.follow!(account)
       list.accounts << account
+
+      account.suspend!
     end
 
     it "unmerges from local followers' feeds" do
@@ -21,8 +23,8 @@ RSpec.describe SuspendAccountService, type: :service do
       expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
     end
 
-    it 'marks account as suspended' do
-      expect { subject }.to change { account.suspended? }.from(false).to(true)
+    it 'does not change the “suspended” flag' do
+      expect { subject }.to_not change { account.suspended? }
     end
   end