Destroy unconfirmed commands so that they don't end up in the user history

This commit is contained in:
Jorge Manrubia
2025-05-07 14:29:46 +02:00
parent bfc89124cf
commit b017a3fd67
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -11,6 +11,7 @@ class CommandsController < ApplicationController
result = command.execute
respond_with_execution_result(result)
else
command.destroy
render plain: command.title, status: :conflict
end
else
+1 -1
View File
@@ -22,7 +22,7 @@ class CommandsControllerTest < ActionDispatch::IntegrationTest
end
test "commands requiring confirmation return a 409 conflict response" do
assert_difference -> { users(:kevin).commands.count }, +1 do
assert_no_difference -> { users(:kevin).commands.count } do
post commands_path, params: { command: "/assign @kevin" }, headers: { "HTTP_REFERER" => cards_path }
end