a11yist/test/controllers/link_categories_controller_test.rb
david 6e1a17281d
Some checks failed
/ Run tests (push) Failing after 55s
/ Run system tests (push) Failing after 55s
/ Build, push and deploy image (push) Has been skipped
Fix tests
2024-09-22 22:49:53 +02:00

69 lines
1.7 KiB
Ruby

# frozen_string_literal: true
require "test_helper"
class LinkCategoriesControllerTest < ActionDispatch::IntegrationTest
def login(email, password)
post "/login", params: { email: email, password: password }
assert_redirected_to "/"
end
def logout
post "/logout"
assert_redirected_to "/"
end
teardown do
logout
end
setup do
@link_category = link_categories(:one)
Account.create(email: "test@example.com", password: "password")
login("test@example.com", "password")
end
test "should get index" do
get link_categories_url
assert_response :success
end
test "should get new" do
get new_link_category_url
assert_response :success
end
test "should create link_category" do
assert_difference("LinkCategory.count") do
post link_categories_url,
params: { link_category: { description: @link_category.description, name: @link_category.name } }
end
assert_redirected_to link_category_url(LinkCategory.last)
end
test "should show link_category" do
get link_category_url(@link_category)
assert_response :success
end
test "should get edit" do
get edit_link_category_url(@link_category)
assert_response :success
end
test "should update link_category" do
patch link_category_url(@link_category),
params: { link_category: { description: @link_category.description, name: @link_category.name } }
assert_redirected_to link_category_url(@link_category)
end
test "should destroy link_category" do
assert_difference("LinkCategory.count", -1) do
link_category = link_categories(:deletable)
delete link_category_url(link_category)
end
assert_redirected_to link_categories_url
end
end