From 3003105ac9b78bce8c74a30c5613a513c7da54a0 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 18 Apr 2025 16:16:04 +0200 Subject: [PATCH] Flesh out the rest of the controller tests --- test/controllers/workflows_controller_test.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/controllers/workflows_controller_test.rb b/test/controllers/workflows_controller_test.rb index 392f6514b..8d3d64c69 100644 --- a/test/controllers/workflows_controller_test.rb +++ b/test/controllers/workflows_controller_test.rb @@ -11,9 +11,33 @@ class WorkflowsControllerTest < ActionDispatch::IntegrationTest end test "create" do + get new_workflow_path + assert_response :success + assert_difference -> { Workflow.count }, +1 do post workflows_path, params: { workflow: { name: "My new workflow!" } } assert_redirected_to workflows_path end end + + test "show" do + get workflow_path(workflows(:on_call)) + assert_in_body workflows(:on_call).name + end + + test "update" do + get edit_workflow_path(workflows(:on_call)) + assert_response :success + + put workflow_path(workflows(:on_call)), params: { workflow: { name: "Monkeyflow!" } } + follow_redirect! + assert_in_body "Monkeyflow!" + end + + test "destroy" do + assert_difference -> { Workflow.count }, -1 do + delete workflow_path(workflows(:on_call)) + assert_redirected_to workflows_path + end + end end