Scaffold Todo
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

This commit is contained in:
2025-10-27 10:18:59 +01:00
parent a33de989ae
commit 6776729eab
19 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
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

9
test/fixtures/todos.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
description: MyText
two:
name: MyString
description: MyText

7
test/models/todo_test.rb Normal file
View File

@@ -0,0 +1,7 @@
require "test_helper"
class TodoTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end