Fixed up controller test

This commit is contained in:
David Heinemeier Hansson
2025-04-16 16:37:06 +02:00
parent ac3307ee23
commit 91194d1b66
2 changed files with 23 additions and 17 deletions
@@ -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
@@ -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