Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove more channel settings in specs

Oliver Günther208c8365eb28
diff --git a/app/workers/notifications/workflow_job.rb b/app/workers/notifications/workflow_job.rb
index e5f9aa08ba7..67775f28419 100644
--- a/app/workers/notifications/workflow_job.rb
+++ b/app/workers/notifications/workflow_job.rb
@@ -66,12 +66,11 @@ class Notifications::WorkflowJob < ApplicationJob
Notification
.where(id: notification_ids)
.unsent_mail
- .where(reason: NotificationSetting.mail_reasons)
+ .where(reason: NotificationSetting.email_settings)
.each do |notification|
- Notifications::MailService
- .new(notification)
- .call
- end
+ Notifications::MailService
+ .new(notification)
+ .call
end
end
end
diff --git a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
index f635c668690..9a77006ad44 100644
--- a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
+++ b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
@@ -72,9 +72,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
context 'with the user having registered for involved notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true)),
]
end
@@ -84,9 +82,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
context 'with the user having registered for no notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false),
]
end
@@ -123,9 +119,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
context 'with the user having registered for involved notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -135,9 +129,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
context 'with the user having registered for no notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
diff --git a/spec/models/notification_settings/scopes/applicable_spec.rb b/spec/models/notification_settings/scopes/applicable_spec.rb
index 63a917bfd1d..64a4a73a143 100644
--- a/spec/models/notification_settings/scopes/applicable_spec.rb
+++ b/spec/models/notification_settings/scopes/applicable_spec.rb
@@ -43,8 +43,7 @@ describe NotificationSettings::Scopes::Applicable, type: :model do
context 'when only global settings exist' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, project: nil),
- FactoryBot.build(:in_app_notification_setting, project: nil)
+ FactoryBot.build(:notification_setting, project: nil)
]
end
@@ -57,14 +56,12 @@ describe NotificationSettings::Scopes::Applicable, type: :model do
context 'when global and project settings exist' do
let(:project_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, project: project),
- FactoryBot.build(:in_app_notification_setting, project: project)
+ FactoryBot.build(:notification_setting, project: project)
]
end
let(:global_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting),
- FactoryBot.build(:in_app_notification_setting)
+ FactoryBot.build(:notification_setting)
]
end
let(:notification_settings) { project_notification_settings + global_notification_settings }
@@ -79,14 +76,12 @@ describe NotificationSettings::Scopes::Applicable, type: :model do
let(:other_project) { FactoryBot.create(:project) }
let(:project_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, project: other_project),
- FactoryBot.build(:in_app_notification_setting, project: other_project)
+ FactoryBot.build(:notification_setting, project: other_project)
]
end
let(:global_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting),
- FactoryBot.build(:in_app_notification_setting)
+ FactoryBot.build(:notification_setting)
]
end
let(:notification_settings) { project_notification_settings + global_notification_settings }
diff --git a/spec/models/users/scopes/notified_on_all_spec.rb b/spec/models/users/scopes/notified_on_all_spec.rb
index 81c3a5518f4..eee82acaed7 100644
--- a/spec/models/users/scopes/notified_on_all_spec.rb
+++ b/spec/models/users/scopes/notified_on_all_spec.rb
@@ -45,8 +45,7 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'when user is notified about everything' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: true),
- FactoryBot.build(:in_app_notification_setting, all: true)
+ FactoryBot.build(:notification_setting, all: true)
]
end
@@ -58,8 +57,7 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'with in app notifications disabled' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: true),
- FactoryBot.build(:in_app_notification_setting, all: false)
+ FactoryBot.build(:notification_setting, all: true)
]
end
@@ -72,8 +70,7 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'with mail notifications disabled' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: false),
- FactoryBot.build(:in_app_notification_setting, all: true)
+ FactoryBot.build(:notification_setting, all: false)
]
end
@@ -86,8 +83,7 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'with all disabled' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: false),
- FactoryBot.build(:in_app_notification_setting, all: false)
+ FactoryBot.build(:notification_setting, all: false)
]
end
@@ -100,10 +96,8 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'with all disabled as a default but enabled in the project' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: false),
- FactoryBot.build(:in_app_notification_setting, all: false),
- FactoryBot.build(:mail_notification_setting, project: project, all: true),
- FactoryBot.build(:in_app_notification_setting, project: project, all: true)
+ FactoryBot.build(:notification_setting, all: false),
+ FactoryBot.build(:notification_setting, project: project, all: true)
]
end
@@ -116,10 +110,8 @@ describe Users::Scopes::NotifiedOnAll, type: :model do
context 'with all enabled as a default but disabled in the project' do
let(:notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, all: true),
- FactoryBot.build(:in_app_notification_setting, all: true),
- FactoryBot.build(:mail_notification_setting, project: project, all: false),
- FactoryBot.build(:in_app_notification_setting, project: project, all: false)
+ FactoryBot.build(:notification_setting, all: true),
+ FactoryBot.build(:notification_setting, project: project, all: false)
]
end
diff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rb
index 0bf41e1a640..41df103a6cc 100644
--- a/spec/services/notifications/create_from_journal_job_shared.rb
+++ b/spec/services/notifications/create_from_journal_job_shared.rb
@@ -42,9 +42,7 @@ shared_context 'with CreateFromJournalJob context' do
let(:recipient_login) { "johndoe" }
let(:other_user) do
notification_settings = [
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
FactoryBot.create(:user,
@@ -64,9 +62,7 @@ shared_context 'with CreateFromJournalJob context' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
let(:send_notifications) { true }
diff --git a/spec/services/notifications/create_from_model_service_wiki_spec.rb b/spec/services/notifications/create_from_model_service_wiki_spec.rb
index 7cdec03710e..20ccde1de25 100644
--- a/spec/services/notifications/create_from_model_service_wiki_spec.rb
+++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb
@@ -77,9 +77,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for involved notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -89,9 +87,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for no notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -101,9 +97,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for watcher notifications and watching the wiki' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -126,9 +120,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user not having registered for watcher notifications and watching the wiki' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -142,9 +134,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for watcher notifications and not watching the wiki' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -179,9 +169,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for involved notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -191,9 +179,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for no notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -203,9 +189,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for watcher notifications and watching the wiki' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -227,9 +211,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user not having registered for watcher notifications and watching the wiki' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -243,9 +225,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for watcher notifications and not watching the wiki nor the page' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -255,9 +235,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user having registered for watcher notifications and watching the page' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -279,9 +257,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
context 'with the user not having registered for watcher notifications and watching the page' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
diff --git a/spec/services/notifications/create_from_model_service_work_package_spec.rb b/spec/services/notifications/create_from_model_service_work_package_spec.rb
index fdfe013d237..1ef1ee71efa 100644
--- a/spec/services/notifications/create_from_model_service_work_package_spec.rb
+++ b/spec/services/notifications/create_from_model_service_work_package_spec.rb
@@ -105,9 +105,7 @@ describe Notifications::CreateFromModelService,
let(:user_property) { :assigned_to }
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -124,9 +122,7 @@ describe Notifications::CreateFromModelService,
context 'when assignee has in app notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: false)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
@@ -144,9 +140,7 @@ describe Notifications::CreateFromModelService,
context 'assignee has mail notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -164,9 +158,7 @@ describe Notifications::CreateFromModelService,
context 'assignee has all notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -176,9 +168,7 @@ describe Notifications::CreateFromModelService,
context 'assignee has all in app notifications enabled but only involved for mail' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -208,9 +198,7 @@ describe Notifications::CreateFromModelService,
context 'when assignee has all notifications enabled but made the change himself' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
let(:author) { recipient }
@@ -223,9 +211,7 @@ describe Notifications::CreateFromModelService,
let(:user_property) { :responsible }
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: true))
]
end
@@ -242,9 +228,7 @@ describe Notifications::CreateFromModelService,
context 'when responsible has in app notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: false)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(involved: false))
]
end
@@ -262,9 +246,7 @@ describe Notifications::CreateFromModelService,
context 'when responsible has mail notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -282,9 +264,7 @@ describe Notifications::CreateFromModelService,
context 'when responsible has all notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -306,9 +286,7 @@ describe Notifications::CreateFromModelService,
context 'when responsible has all notifications enabled but made the change himself' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
let(:author) { recipient }
@@ -321,9 +299,7 @@ describe Notifications::CreateFromModelService,
let(:user_property) { :watcher }
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true),
]
end
@@ -340,9 +316,7 @@ describe Notifications::CreateFromModelService,
context 'when watcher has in app notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(watched: true))
]
end
@@ -360,9 +334,7 @@ describe Notifications::CreateFromModelService,
context 'when watcher has mail notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -380,9 +352,7 @@ describe Notifications::CreateFromModelService,
context 'when watcher has all notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -398,9 +368,7 @@ describe Notifications::CreateFromModelService,
context 'when watcher has all notifications enabled but made the change himself' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
let(:author) { recipient }
@@ -414,9 +382,7 @@ describe Notifications::CreateFromModelService,
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
@@ -433,9 +399,7 @@ describe Notifications::CreateFromModelService,
context 'with in app notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
@@ -453,9 +417,7 @@ describe Notifications::CreateFromModelService,
context 'with mail notifications disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -473,9 +435,7 @@ describe Notifications::CreateFromModelService,
context 'with all disabled' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -485,12 +445,8 @@ describe Notifications::CreateFromModelService,
context 'with all disabled as a default but enabled in the project' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_notification_setting, project: project, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, project: project, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, project: project, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false),
+ FactoryBot.build(:notification_setting, project: project, **notification_settings_all_true)
]
end
@@ -508,12 +464,8 @@ describe Notifications::CreateFromModelService,
context 'with all enabled as a default but disabled in the project' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_notification_setting, project: project, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, project: project, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, project: project, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true),
+ FactoryBot.build(:notification_setting, project: project, **notification_settings_all_false)
]
end
@@ -529,9 +481,7 @@ describe Notifications::CreateFromModelService,
context 'when recipient has all notifications enabled but made the change himself' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)
+ FactoryBot.build(:notification_setting, **notification_settings_all_true)
]
end
let(:author) { recipient }
@@ -544,12 +494,8 @@ describe Notifications::CreateFromModelService,
context 'when the user configured to be notified on work package creation' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_created: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_created: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_created: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_created: true))
]
end
@@ -567,12 +513,8 @@ describe Notifications::CreateFromModelService,
context 'when the user configured to be notified on work package status changes' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_processed: true))
]
end
@@ -582,12 +524,8 @@ describe Notifications::CreateFromModelService,
context 'when the user configured to be notified on work package priority changes' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
.merge(work_package_prioritized: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true))
]
end
@@ -597,9 +535,7 @@ describe Notifications::CreateFromModelService,
context 'when the user did not configure to be notified' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -613,12 +549,8 @@ describe Notifications::CreateFromModelService,
context 'when the user has commented notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
.merge(work_package_commented: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_commented: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_commented: true))
]
end
@@ -636,9 +568,7 @@ describe Notifications::CreateFromModelService,
context 'when the user has commented notifications deactivated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -652,12 +582,8 @@ describe Notifications::CreateFromModelService,
context 'with the user having commented notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_commented: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_commented: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_commented: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_commented: true))
]
end
@@ -671,12 +597,8 @@ describe Notifications::CreateFromModelService,
context 'when the user has processed notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_processed: true))
]
end
@@ -694,9 +616,7 @@ describe Notifications::CreateFromModelService,
context 'when the user has processed notifications deactivated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -710,12 +630,8 @@ describe Notifications::CreateFromModelService,
context 'with the user having processed notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_processed: true))
]
end
@@ -729,12 +645,8 @@ describe Notifications::CreateFromModelService,
context 'when the user has prioritized notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_prioritized: true))
]
end
@@ -752,9 +664,7 @@ describe Notifications::CreateFromModelService,
context 'when the user has prioritized notifications deactivated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -768,12 +678,8 @@ describe Notifications::CreateFromModelService,
context 'with the user having prioritized notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_prioritized: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_prioritized: true))
]
end
@@ -787,12 +693,8 @@ describe Notifications::CreateFromModelService,
context 'when the user has scheduled notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_scheduled: true))
]
end
@@ -811,9 +713,7 @@ describe Notifications::CreateFromModelService,
context 'when the user has scheduled notifications deactivated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -827,12 +727,8 @@ describe Notifications::CreateFromModelService,
context 'with the user having scheduled notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_processed: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_scheduled: true))
]
end
@@ -846,12 +742,8 @@ describe Notifications::CreateFromModelService,
context 'when the user has scheduled notifications activated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false
- .merge(work_package_scheduled: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false
+ .merge(work_package_scheduled: true))
]
end
@@ -869,9 +761,7 @@ describe Notifications::CreateFromModelService,
context 'when the user has scheduled notifications deactivated' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false)
+ FactoryBot.build(:notification_setting, **notification_settings_all_false)
]
end
@@ -903,9 +793,7 @@ describe Notifications::CreateFromModelService,
context 'when user is mentioned' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(mentioned: true)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(mentioned: true)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(mentioned: true))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(mentioned: true))
]
end
@@ -926,9 +814,7 @@ describe Notifications::CreateFromModelService,
context 'user disabled mention notifications' do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(mentioned: false)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(mentioned: false)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(mentioned: false))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(mentioned: false))
]
end
@@ -1042,9 +928,7 @@ describe Notifications::CreateFromModelService,
context "when the recipient turned off mention notifications" do
let(:recipient_notification_settings) do
[
- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(mentioned: false)),
- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(mentioned: false)),
- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(mentioned: false))
+ FactoryBot.build(:notification_setting, **notification_settings_all_false.merge(mentioned: false))
]
end
diff --git a/spec/workers/mails/shared/watcher_job.rb b/spec/workers/mails/shared/watcher_job.rb
index a71214e933c..7eac88f49fd 100644
--- a/spec/workers/mails/shared/watcher_job.rb
+++ b/spec/workers/mails/shared/watcher_job.rb
@@ -46,7 +46,7 @@ shared_examples "watcher job" do |action|
FactoryBot.build_stubbed(:user_preference)
end
let(:notification_settings) do
- [FactoryBot.build_stubbed(:mail_notification_setting, all: true)]
+ [FactoryBot.build_stubbed(:notification_setting, all: true)]
end
let(:watching_user) do
FactoryBot.build_stubbed(:user,
@@ -132,25 +132,25 @@ shared_examples "watcher job" do |action|
it_behaves_like 'notifies the watcher' do
let(:notification_settings) do
- [FactoryBot.build_stubbed(:mail_notification_setting, mentioned: false, involved: false, watched: false, all: true)]
+ [FactoryBot.build_stubbed(:notification_setting, mentioned: false, involved: false, watched: false, all: true)]
end
end
it_behaves_like 'notifies the watcher' do
let(:notification_settings) do
- [FactoryBot.build_stubbed(:mail_notification_setting, mentioned: false, involved: false, watched: true)]
+ [FactoryBot.build_stubbed(:notification_setting, mentioned: false, involved: false, watched: true)]
end
end
it_behaves_like 'does not notify the watcher' do
let(:notification_settings) do
- [FactoryBot.build_stubbed(:mail_notification_setting, mentioned: false, involved: true, watched: false)]
+ [FactoryBot.build_stubbed(:notification_setting, mentioned: false, involved: true, watched: false)]
end
end
it_behaves_like 'does not notify the watcher' do
let(:notification_settings) do
- [FactoryBot.build_stubbed(:mail_notification_setting, mentioned: true, involved: false, watched: false)]
+ [FactoryBot.build_stubbed(:notification_setting, mentioned: true, involved: false, watched: false)]
end
end
end