tabletop-companion/test/services/template_builder_test.rb

19 lines
570 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "test_helper"
class TemplateBuilderTest < ActiveSupport::TestCase
test "creates template from a CharacterSheetSection" do
section = character_sheet_sections(:stats)
template = TemplateBuilder.create!(
name: "Test template",
game_system: GameSystem.last,
from: section,
)
template_hash = JSON.parse(template.content)
assert_equal 1, template_hash["character_sheet_subsections"].count
assert_equal 3, template_hash["stats"].count
assert_equal "Stats", template_hash["name"]
end
end