a11yist/test/controllers/pages_controller_test.rb
david c35c7da6e0
Some checks failed
/ Run tests (push) Successful in 2m51s
/ Run system tests (push) Failing after 3m29s
/ Build, push and deploy image (push) Has been cancelled
Migrate to Rais 8.0
- Remove all Rodauth stuff and implement simple custom auth
- Migrate from sprockets to propshaft, hack some bootstrap stuff
2024-11-08 22:05:31 +01:00

55 lines
1.3 KiB
Ruby

require "test_helper"
class PagesControllerTest < ::ControllerTest
teardown do
logout
end
setup do
User.create!(email_address: "test@example.com", password: "password")
@page = pages(:one)
login("test@example.com", "password")
end
test "should get index" do
get report_pages_url(@page.report)
assert_response :success
end
test "should get new" do
get new_report_page_url(@page.report)
assert_response :success
end
test "should create page" do
assert_difference("Page.count") do
post report_pages_url(@page.report), params: { page: { path: @page.path, position: @page.position + 1, url: @page.url } }
end
assert_redirected_to report_url(Page.last.report, page_id: Page.last)
end
test "should show page" do
get page_url(@page)
assert_response :success
end
test "should get edit" do
get edit_page_url(@page)
assert_response :success
end
test "should update page" do
patch page_url(@page), params: { page: { path: @page.path, position: @page.position, report_id: @page.report_id, url: @page.url } }
assert_redirected_to page_url(@page)
end
test "should destroy page" do
assert_difference("Page.count", -1) do
Rails.logger.level = :debug
delete page_url(@page)
end
assert_redirected_to report_pages_url(@page.report)
end
end