Flesh out the rest of the controller tests

This commit is contained in:
David Heinemeier Hansson
2025-04-18 16:16:04 +02:00
parent 7b0d3d033f
commit 3003105ac9
@@ -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