Fix notification broadcast test for turbo-rails 2.0.21

turbo-rails 2.0.21 changed `capture_turbo_stream_broadcasts` to only
return broadcasts produced within the block, matching its documented
behavior (see hotwired/turbo-rails#736).

Since `broadcast_unread` uses `broadcast_prepend_later_to` (async via
job), we need to wrap the call in `perform_enqueued_jobs` so the
broadcast actually happens within the assertion block.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-01-19 19:49:35 +01:00
parent 1083784a98
commit 967f76de99
+3 -1
View File
@@ -15,7 +15,9 @@ class NotificationTest < ActiveSupport::TestCase
notification.read # Mark as read first
assert_turbo_stream_broadcasts([ notification.user, :notifications ], count: 1) do
notification.unread
perform_enqueued_jobs do
notification.unread
end
end
end