From 866a80e133d8ba3464fc95d0f146e6f94ebbe361 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 5 Apr 2025 15:26:49 +0200 Subject: [PATCH] Fix up the tests --- test/controllers/bubbles/pins_controller_test.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/controllers/bubbles/pins_controller_test.rb b/test/controllers/bubbles/pins_controller_test.rb index 7deee667e..cdde4e7f2 100644 --- a/test/controllers/bubbles/pins_controller_test.rb +++ b/test/controllers/bubbles/pins_controller_test.rb @@ -7,17 +7,25 @@ class Bubbles::PinsControllerTest < ActionDispatch::IntegrationTest test "create" do assert_changes -> { bubbles(:layout).pinned_by?(users(:kevin)) }, from: false, to: true do - post bucket_bubble_pin_url(buckets(:writebook), bubbles(:layout)) + perform_enqueued_jobs do + assert_turbo_stream_broadcasts([ users(:kevin), :pins ], count: 1) do + post bucket_bubble_pin_path(buckets(:writebook), bubbles(:layout)) + end + end end - assert_redirected_to bucket_bubble_pin_url(buckets(:writebook), bubbles(:layout)) + assert_redirected_to bucket_bubble_pin_path(buckets(:writebook), bubbles(:layout)) end test "destroy" do assert_changes -> { bubbles(:shipping).pinned_by?(users(:kevin)) }, from: true, to: false do - delete bucket_bubble_pin_url(buckets(:writebook), bubbles(:shipping)) + perform_enqueued_jobs do + assert_turbo_stream_broadcasts([ users(:kevin), :pins ], count: 1) do + delete bucket_bubble_pin_path(buckets(:writebook), bubbles(:shipping)) + end + end end - assert_redirected_to bucket_bubble_pin_url(buckets(:writebook), bubbles(:shipping)) + assert_redirected_to bucket_bubble_pin_path(buckets(:writebook), bubbles(:shipping)) end end