Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

モーフ用のテストも書いたよ #2

Open
wants to merge 2 commits into
base: 20241120
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions test/system/tasks_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require "application_system_test_case"

class TasksTest < ApplicationSystemTestCase
test "CRUD tasks" do
visit tasks_url

assert_selector "h1", text: "Tasks"

fill_in "Title", with: "ミルクを買う"
click_on "Create Task"
assert_text "Task was successfully created."
within "#tasks" do
assert_text "ミルクを買う"
end
assert_field "Title", with: ""
assert_text "Remains: 1 / Total: 1"

fill_in "Title", with: "ネギを買う"
click_on "Create Task"
assert_text "Task was successfully created."
within "#tasks" do
assert_text "ネギを買う"
end
assert_field "Title", with: ""
assert_text "Remains: 2 / Total: 2"

rows = all("#tasks tbody tr")
assert_equal 2, rows.size
within rows[0] do
assert_text "ミルクを買う"
assert_text "not yet"
click_on "DONE"
assert_text "done"
end
assert_text "Task was successfully updated."
assert_text "Remains: 1 / Total: 2"

within rows[1] do
assert_text "ネギを買う"
click_on "DELETE"
end
assert_text "Task was successfully deleted."
refute_text "ネギを買う"
assert_text "Remains: 0 / Total: 1"
end
end