Sha256: e862a61a84f83583deaa21ae42ea43afc34fbb05d4fb17b4806b89570cc83ccf
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
# coding: utf-8 require 'test_helper' class Thinreports::Core::Shape::List::TestFormat < Minitest::Test include Thinreports::TestHelper TEST_LIST_FORMAT = { "type" => "s-list", "id" => "List", "display" => "true", "page-footer-enabled" => "true", "footer-enabled" => "true", "header-enabled" => "true", "page-break" => "true", "content-height" => 255, "detail" => {}, "footer" => {}, "page-footer" => {}, "header" => {}, "svg" => { "tag" => "g", "attrs" => {} } } List = Thinreports::Core::Shape::List def test_build_when_all_sections_enabled List::SectionFormat.expects(:build).returns({}).times(4) begin format = build_format rescue => e flunk exception_details(e, 'Building failed.') end assert_equal format.sections.size, 4 [:detail, :header, :footer, :page_footer].each do |sec| assert_includes format.sections.keys, sec end end def test_build_when_page_footer_and_footer_disabled List::SectionFormat.expects(:build).returns({}).times(2) format = build_format('page-footer-enabled' => 'false', 'footer-enabled' => 'false') assert_equal format.sections.size, 2 [:detail, :header].each do |sec| assert_includes format.sections.keys, sec end end def test_config_readers format = List::Format.new(TEST_LIST_FORMAT) assert_equal format.height, 255 assert_equal format.auto_page_break?, true assert_equal format.has_header?, true assert_equal format.has_footer?, true assert_equal format.has_page_footer?, true end def build_format(data = {}) List::Format.build(TEST_LIST_FORMAT.merge(data)) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
thinreports-0.8.2 | test/unit/core/shape/list/test_format.rb |
thinreports-0.8.1 | test/unit/core/shape/list/test_format.rb |
thinreports-0.8.0 | test/unit/core/shape/list/test_format.rb |