Show confirmation when submitting certain commands

https://3.basecamp.com/2914079/buckets/37331921/todos/8617430347
This commit is contained in:
Jorge Manrubia
2025-05-07 09:33:19 +02:00
parent 22c3c33c0b
commit 8697cabbe2
8 changed files with 105 additions and 16 deletions
+9 -1
View File
@@ -15,12 +15,20 @@ class CommandsControllerTest < ActionDispatch::IntegrationTest
test "command that triggers a redirect back" do
assert_difference -> { users(:kevin).commands.count }, +1 do
post commands_path, params: { command: "/assign @kevin" }, headers: { "HTTP_REFERER" => cards_path }
post commands_path, params: { command: "/assign @kevin", confirmed: "confirmed" }, headers: { "HTTP_REFERER" => cards_path }
end
assert_redirected_to cards_path
end
test "commands requiring confirmation return a 409 conflict response" do
assert_difference -> { users(:kevin).commands.count }, +1 do
post commands_path, params: { command: "/assign @kevin" }, headers: { "HTTP_REFERER" => cards_path }
end
assert_response :conflict
end
test "get a 422 on errors" do
post commands_path, params: { command: "/assign @some_missing_user" }, headers: { "HTTP_REFERER" => cards_path }
assert_response :unprocessable_entity