From 91194d1b66556b82646c57819dfd4abb49c5ea09 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 16 Apr 2025 16:37:06 +0200 Subject: [PATCH] Fixed up controller test --- .../mark_all_reads_controller_test.rb | 17 -------------- .../notifications/readings_controller_test.rb | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 test/controllers/notifications/mark_all_reads_controller_test.rb create mode 100644 test/controllers/notifications/readings_controller_test.rb diff --git a/test/controllers/notifications/mark_all_reads_controller_test.rb b/test/controllers/notifications/mark_all_reads_controller_test.rb deleted file mode 100644 index 31ca45a68..000000000 --- a/test/controllers/notifications/mark_all_reads_controller_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require "test_helper" - -class Notifications::MarkAllReadsControllerTest < ActionDispatch::IntegrationTest - setup do - sign_in_as :kevin - end - - test "show" do - assert_changes -> { notifications(:logo_published_kevin).reload.read? }, from: false, to: true do - assert_changes -> { notifications(:layout_commented_kevin).reload.read? }, from: false, to: true do - post read_all_notifications_path - end - end - - assert_response :success - end -end diff --git a/test/controllers/notifications/readings_controller_test.rb b/test/controllers/notifications/readings_controller_test.rb new file mode 100644 index 000000000..75a8a4875 --- /dev/null +++ b/test/controllers/notifications/readings_controller_test.rb @@ -0,0 +1,23 @@ +require "test_helper" + +class Notifications::ReadingsControllerTest < ActionDispatch::IntegrationTest + setup do + sign_in_as :kevin + end + + test "create" do + assert_changes -> { notifications(:logo_published_kevin).reload.read? }, from: false, to: true do + post read_notification_path(notifications(:logo_published_kevin), format: :turbo_stream) + assert_response :success + end + end + + test "create all" do + assert_changes -> { notifications(:logo_published_kevin).reload.read? }, from: false, to: true do + assert_changes -> { notifications(:layout_commented_kevin).reload.read? }, from: false, to: true do + post read_all_notifications_path + assert_redirected_to notifications_path + end + end + end +end