From 967f76de99494f08a8a6d2a1be45120c74d0b968 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Mon, 19 Jan 2026 19:49:35 +0100 Subject: [PATCH] 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 --- test/models/notification_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/models/notification_test.rb b/test/models/notification_test.rb index cb230070a..9c8ebbe12 100644 --- a/test/models/notification_test.rb +++ b/test/models/notification_test.rb @@ -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