about summary refs log tree commit diff
path: root/spec/services/delete_account_service_spec.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-08-08 15:29:57 +0200
committerGitHub <noreply@github.com>2021-08-08 15:29:57 +0200
commit763ab0c7eb5430235ca8a354d11e00de1d8ba6dd (patch)
tree424b1ab20882facd51ef8e1140381b6cf56e850f /spec/services/delete_account_service_spec.rb
parent818e0b314fc81005dc9a73b53331f75ad52daa0d (diff)
Fix owned account notes not being deleted when an account is deleted (#16579)
* Add account_notes relationship

* Add tests

* Fix owned account notes not being deleted when an account is deleted

* Add post-migration to clean up orphaned account notes
Diffstat (limited to 'spec/services/delete_account_service_spec.rb')
-rw-r--r--spec/services/delete_account_service_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb
index cd7d32d59..b1da97036 100644
--- a/spec/services/delete_account_service_spec.rb
+++ b/spec/services/delete_account_service_spec.rb
@@ -21,6 +21,8 @@ RSpec.describe DeleteAccountService, type: :service do
     let!(:favourite_notification) { Fabricate(:notification, account: local_follower, activity: favourite, type: :favourite) }
     let!(:follow_notification) { Fabricate(:notification, account: local_follower, activity: active_relationship, type: :follow) }
 
+    let!(:account_note) { Fabricate(:account_note, account: account) }
+
     subject do
       -> { described_class.new.call(account) }
     end
@@ -35,8 +37,9 @@ RSpec.describe DeleteAccountService, type: :service do
           account.active_relationships,
           account.passive_relationships,
           account.polls,
+          account.account_notes,
         ].map(&:count)
-      }.from([2, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0])
+      }.from([2, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
     end
 
     it 'deletes associated target records' do