Add controller tests for undo

This commit is contained in:
Jorge Manrubia
2025-05-06 15:17:57 +02:00
parent e8adf15ba7
commit 37bf992d67
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,19 @@
require "test_helper"
class UndosControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :jz
end
test "undo and destroy a command" do
assert_includes cards(:logo).reload.assignees, users(:jz)
assert_difference -> { users(:jz).commands.reload.count }, -1 do
post command_undo_path(commands(:logo_assign_to_jz_command)), headers: { "HTTP_REFERER" => cards_path }
end
assert_not_includes cards(:logo).reload.assignees, users(:jz)
assert_redirected_to cards_path
end
end