Files
doable/test/controllers/todos_controller_test.rb
Tarek Belkahia 6776729eab
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled
Scaffold Todo
2025-10-27 10:18:59 +01:00

49 lines
1.0 KiB
Ruby

require "test_helper"
class TodosControllerTest < ActionDispatch::IntegrationTest
setup do
@todo = todos(:one)
end
test "should get index" do
get todos_url
assert_response :success
end
test "should get new" do
get new_todo_url
assert_response :success
end
test "should create todo" do
assert_difference("Todo.count") do
post todos_url, params: { todo: { description: @todo.description, name: @todo.name } }
end
assert_redirected_to todo_url(Todo.last)
end
test "should show todo" do
get todo_url(@todo)
assert_response :success
end
test "should get edit" do
get edit_todo_url(@todo)
assert_response :success
end
test "should update todo" do
patch todo_url(@todo), params: { todo: { description: @todo.description, name: @todo.name } }
assert_redirected_to todo_url(@todo)
end
test "should destroy todo" do
assert_difference("Todo.count", -1) do
delete todo_url(@todo)
end
assert_redirected_to todos_url
end
end