a11yist/test/controllers/links_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

60 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require "test_helper"
class LinksControllerTest < ::ControllerTest
teardown do
logout
end
setup do
@link = links(:one)
User.create!(email_address: "test@example.com", password: "password")
login("test@example.com", "password")
end
test "should get index" do
get links_url
assert_response :success
end
test "should get new" do
get new_link_url
assert_response :success
end
test "should create link" do
assert_difference("Link.count") do
post links_url,
params: { link: { fail_count: @link.fail_count, last_check_at: @link.last_check_at,
link_category_id: @link.link_category_id, text: @link.text, url: @link.url } }
end
assert_redirected_to link_url(Link.last)
end
test "should show link" do
get link_url(@link)
assert_response :success
end
test "should get edit" do
get edit_link_url(@link)
assert_response :success
end
test "should update link" do
patch link_url(@link),
params: { link: { fail_count: @link.fail_count, last_check_at: @link.last_check_at,
link_category_id: @link.link_category_id, text: @link.text, url: @link.url } }
assert_redirected_to link_url(@link)
end
test "should destroy link" do
assert_difference("Link.count", -1) do
delete link_url(@link)
end
assert_redirected_to links_url
end
end