about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2023-03-30 14:44:00 +0200
committerGitHub <noreply@github.com>2023-03-30 14:44:00 +0200
commita9b5598c97fc4d3302b61b260097ef41c2ebe377 (patch)
tree2568f87b80c64214f3d03bedb6e6f85a77e9ddb0 /spec/services
parente7c3e5587489a9e248973fa0719869541d34ba9f (diff)
Change user settings to be stored in a more optimal way (#23630)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/notify_service_spec.rb7
-rw-r--r--spec/services/report_service_spec.rb3
2 files changed, 6 insertions, 4 deletions
diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb
index c58cebbfb..616a7aa20 100644
--- a/spec/services/notify_service_spec.rb
+++ b/spec/services/notify_service_spec.rb
@@ -54,7 +54,8 @@ RSpec.describe NotifyService, type: :service do
     let(:type)     { :mention }
 
     before do
-      user.settings.interactions = user.settings.interactions.merge('must_be_following_dm' => enabled)
+      user.settings.update('interactions.must_be_following_dm': enabled)
+      user.save
     end
 
     context 'if recipient is supposed to be following sender' do
@@ -155,8 +156,8 @@ RSpec.describe NotifyService, type: :service do
     before do
       ActionMailer::Base.deliveries.clear
 
-      notification_emails = user.settings.notification_emails
-      user.settings.notification_emails = notification_emails.merge('follow' => enabled)
+      user.settings.update('notification_emails.follow': enabled)
+      user.save
     end
 
     context 'when email notification is enabled' do
diff --git a/spec/services/report_service_spec.rb b/spec/services/report_service_spec.rb
index 9d81bd971..452400f72 100644
--- a/spec/services/report_service_spec.rb
+++ b/spec/services/report_service_spec.rb
@@ -96,7 +96,8 @@ RSpec.describe ReportService, type: :service do
 
     before do
       ActionMailer::Base.deliveries.clear
-      source_account.user.settings.notification_emails['report'] = true
+      source_account.user.settings['notification_emails.report'] = true
+      source_account.user.save
     end
 
     it 'does not send an e-mail' do