2024-07-22 22:40:56 +02:00
|
|
|
require 'test_helper'
|
2024-07-19 02:29:18 +02:00
|
|
|
|
|
|
|
|
class ChecklistEntriesControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
|
setup do
|
|
|
|
|
@checklist_entry = checklist_entries(:one)
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should get index' do
|
2024-07-19 02:29:18 +02:00
|
|
|
get checklist_entries_url
|
|
|
|
|
assert_response :success
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should get new' do
|
|
|
|
|
get new_checklist_entry_url(checklist_id: @checklist_entry.checklist_id)
|
2024-07-19 02:29:18 +02:00
|
|
|
assert_response :success
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should create checklist_entry' do
|
|
|
|
|
assert_difference('ChecklistEntry.count') do
|
|
|
|
|
post checklist_entries_url,
|
|
|
|
|
params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id,
|
|
|
|
|
position: @checklist_entry.position } }
|
2024-07-19 02:29:18 +02:00
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
assert_redirected_to checklist_url(ChecklistEntry.last.checklist)
|
2024-07-19 02:29:18 +02:00
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should show checklist_entry' do
|
2024-07-19 02:29:18 +02:00
|
|
|
get checklist_entry_url(@checklist_entry)
|
|
|
|
|
assert_response :success
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should get edit' do
|
2024-07-19 02:29:18 +02:00
|
|
|
get edit_checklist_entry_url(@checklist_entry)
|
|
|
|
|
assert_response :success
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should update checklist_entry' do
|
|
|
|
|
patch checklist_entry_url(@checklist_entry),
|
|
|
|
|
params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id,
|
|
|
|
|
position: @checklist_entry.position } }
|
|
|
|
|
assert_redirected_to checklist_url(@checklist_entry.checklist)
|
2024-07-19 02:29:18 +02:00
|
|
|
end
|
|
|
|
|
|
2024-07-22 22:40:56 +02:00
|
|
|
test 'should destroy checklist_entry' do
|
|
|
|
|
assert_difference('ChecklistEntry.count', -1) do
|
2024-07-19 02:29:18 +02:00
|
|
|
delete checklist_entry_url(@checklist_entry)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_redirected_to checklist_entries_url
|
|
|
|
|
end
|
|
|
|
|
end
|