tabletop-companion/test/models/game_system_test.rb

34 lines
835 B
Ruby
Raw Normal View History

2024-05-26 10:45:10 +00:00
# frozen_string_literal: true
2024-05-26 08:51:31 +00:00
require "test_helper"
class GameSystemTest < ActiveSupport::TestCase
test "name must exist" do
assert_must_exist(game_systems(:troika), :name)
end
2024-06-05 15:00:02 +00:00
test "cannot delete games with characters" do
game = game_systems(:dnd)
game.tables.destroy_all
assert_no_difference("GameSystem.count") do
game_systems(:dnd).destroy
end
game.characters.destroy_all
assert_difference("GameSystem.count", -1) do
game_systems(:dnd).destroy
end
end
test "cannot delete games with tables" do
game = game_systems(:dnd)
game.characters.destroy_all
assert_no_difference("GameSystem.count") do
game_systems(:dnd).destroy
end
game.tables.destroy_all
assert_difference("GameSystem.count", -1) do
game_systems(:dnd).destroy
end
end
2024-05-26 08:51:31 +00:00
end