tabletop-companion/test/controllers/character_sheet_sections_co...

37 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require "test_helper"
class CharacterSheetSectionsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
sign_in users(:trevor)
get character_character_sheet_sections_url(characters(:nardren))
assert_response :success
end
test "should render new turbo_stream" do
sign_in users(:trevor)
get new_character_character_sheet_section_url(characters(:nardren)), as: :turbo_stream
assert_response :success
end
test "should create character_sheet_section" do
sign_in users(:trevor)
assert_difference "CharacterSheetSection.count", 1 do
post character_character_sheet_sections_url(characters(:nardren)),
params: { character_sheet_section: { name: "test" } },
as: :turbo_stream
end
end
test "should destroy character_sheet_section" do
user = users(:trevor)
sign_in user
assert_difference "CharacterSheetSection.count", -1 do
2024-06-07 14:38:10 +00:00
delete character_sheet_section_url(character_sheet_sections(:subsection)),
as: :turbo_stream
end
end
end