about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorLex Alexander <l.alexander10@gmail.com>2017-10-12 14:52:09 -1000
committerEugen Rochko <eugen@zeonfederated.com>2017-10-13 02:52:09 +0200
commitb8bae9664711f99bfb438687ff3b4b396db69924 (patch)
tree50a7685906897ce677dbf3e8cb14fd16e23ae445 /spec/services
parentd37305c628c37aa16c1356c12aecd8de2105b80f (diff)
Retoot count increases without reason (#5363)
* Retoot count increases without reason

-The store_uri method for Statuses was being called on after_create and causing reblogs to be incremented twice.
-This calls it when the transaction is finished by using after_create_commit.
-Fixes #4916.

* Added test case for after_create_commit callback for checking reblog count.

* Rewrote test to keep original, but added one for only the after_create_commit callback.
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/reblog_service_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb
index 0ad5c5f6b..19d3bb6cb 100644
--- a/spec/services/reblog_service_spec.rb
+++ b/spec/services/reblog_service_spec.rb
@@ -39,6 +39,12 @@ RSpec.describe ReblogService do
       expect(status.reblogs.count).to eq 1
     end
 
+    describe 'after_create_commit :store_uri' do
+      it 'keeps consistent reblog count' do
+        expect(status.reblogs.count).to eq 1
+      end
+    end
+
     it 'distributes to followers' do
       expect(ActivityPub::DistributionWorker).to have_received(:perform_async)
     end