a11yist/test/controllers/checklists_controller_test.rb

61 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2024-09-05 22:54:38 +02:00
# frozen_string_literal: true
require "test_helper"
class ChecklistsControllerTest < ::ControllerTest
2024-09-22 22:49:53 +02:00
teardown do
logout
end
setup do
@checklist = checklists(:one)
User.create!(email_address: "test@example.com", password: "password")
2024-09-22 22:49:53 +02:00
login("test@example.com", "password")
end
test "should get index" do
get checklists_url
assert_response :success
end
test "should get new" do
get new_checklist_url
assert_response :success
end
test "should create checklist" do
assert_difference("Checklist.count") do
2024-09-05 22:54:38 +02:00
post checklists_url,
params: { checklist: { code: @checklist.code, description_html: @checklist.description_html,
name: @checklist.name } }
end
assert_redirected_to checklist_url(Checklist.last)
end
test "should show checklist" do
get checklist_url(@checklist)
assert_response :success
end
test "should get edit" do
get edit_checklist_url(@checklist)
assert_response :success
end
test "should update checklist" do
2024-09-05 22:54:38 +02:00
patch checklist_url(@checklist),
params: { checklist: { code: @checklist.code, description_html: @checklist.description_html,
name: @checklist.name } }
assert_redirected_to checklist_url(@checklist)
end
test "should destroy checklist" do
assert_difference("Checklist.count", -1) do
delete checklist_url(@checklist)
end
assert_redirected_to checklists_url
end
end