Don't bundle new notifications is bundling is disabled

This commit is contained in:
Jorge Manrubia
2025-08-28 12:53:19 +02:00
parent 4e2717a61f
commit 960f074b3f
3 changed files with 17 additions and 4 deletions
+9
View File
@@ -3,6 +3,7 @@ require "test_helper"
class Notification::BundleTest < ActiveSupport::TestCase
setup do
@user = users(:david)
@user.settings.bundle_email_every_few_hours!
end
test "new notifications are bundled" do
@@ -14,6 +15,14 @@ class Notification::BundleTest < ActiveSupport::TestCase
assert_includes bundle.notifications, notification
end
test "don't bundle new notifications if bundling is disabled" do
@user.settings.bundle_email_never!
assert_no_difference -> { @user.notification_bundles.count } do
@user.notifications.create!(source: events(:logo_published), creator: @user)
end
end
test "notifications are bundled withing the aggregation period" do
notification_1 = assert_difference -> { @user.notification_bundles.pending.count }, 1 do
@user.notifications.create!(source: events(:logo_published), creator: @user)