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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user