diff --git a/app/controllers/commands_controller.rb b/app/controllers/commands_controller.rb index 12631b481..d1247a668 100644 --- a/app/controllers/commands_controller.rb +++ b/app/controllers/commands_controller.rb @@ -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 diff --git a/test/controllers/commands_controller_test.rb b/test/controllers/commands_controller_test.rb index 2b5f027ba..96a1dd578 100644 --- a/test/controllers/commands_controller_test.rb +++ b/test/controllers/commands_controller_test.rb @@ -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