about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-04-12 12:47:05 +0200
committerGitHub <noreply@github.com>2023-04-12 12:47:05 +0200
commitf53d009778e2ae7a0a7b246147dff8e6bbec3755 (patch)
treec58348bb915a5e79dfcc9c5a5265c20605fad448 /spec
parentcee357d5385c66a0217827ba3ceab2e77cd2f649 (diff)
Refactor `Status._insert_record` slightly and tighten the test around reblogs of discarded statuses (#24516)
Diffstat (limited to 'spec')
-rw-r--r--spec/services/reblog_service_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb
index c00472229..fdf5ec923 100644
--- a/spec/services/reblog_service_spec.rb
+++ b/spec/services/reblog_service_spec.rb
@@ -38,7 +38,10 @@ RSpec.describe ReblogService, type: :service do
     let(:status) { Fabricate(:status, account: alice, visibility: :public) }
 
     before do
-      status.discard
+      # Update the in-database attribute without reflecting the change in
+      # the object. This cannot simulate all race conditions, but it is
+      # pretty close.
+      Status.where(id: status.id).update_all(deleted_at: Time.now.utc) # rubocop:disable Rails/SkipsModelValidations
     end
 
     it 'raises an exception' do