a11yist/test/controllers/link_categories_controller_test.rb

60 lines
1.5 KiB
Ruby
Raw Normal View History

2024-09-05 22:54:38 +02:00
# frozen_string_literal: true
2024-07-26 00:59:00 +02:00
require "test_helper"
class LinkCategoriesControllerTest < ::ControllerTest
2024-09-22 22:49:53 +02:00
teardown do
logout
end
2024-07-26 00:59:00 +02:00
setup do
@link_category = link_categories(:one)
User.create!(email_address: "test@example.com", password: "password")
2024-09-22 22:49:53 +02:00
login("test@example.com", "password")
2024-07-26 00:59:00 +02:00
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
2024-09-05 22:54:38 +02:00
post link_categories_url,
params: { link_category: { description: @link_category.description, name: @link_category.name } }
2024-07-26 00:59:00 +02:00
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
2024-09-05 22:54:38 +02:00
patch link_category_url(@link_category),
params: { link_category: { description: @link_category.description, name: @link_category.name } }
2024-07-26 00:59:00 +02:00
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