tabletop-companion/test/controllers/stats_controller_test.rb

29 lines
857 B
Ruby

# frozen_string_literal: true
require "test_helper"
class StatsControllerTest < ActionDispatch::IntegrationTest
test "should render new turbo stream" do
sign_in users(:trevor)
get new_character_sheet_section_stat_url(character_sheet_sections(:stats)), as: :turbo_stream
assert_response :success
end
test "should create stat" do
sign_in users(:trevor)
assert_difference "Stat.count", 1 do
post character_sheet_section_stats_url(character_sheet_sections(:stats)),
params: { stat: { name: "Wisdom", character_sheet_section_id: character_sheet_sections(:stats).id } },
as: :turbo_stream
end
end
test "should delete stat" do
sign_in users(:trevor)
assert_difference "Stat.count", -1 do
delete stat_url(Stat.first), as: :turbo_stream
assert_response :success
end
end
end