Sha256: 858060fcea1f20cfea16353d8430cdd19375e36e684c3c1b9bf8fc7080b99e68

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

# coding: utf-8

require 'test_helper'

class Thinreports::Layout::TestBase < Minitest::Test
  include Thinreports::TestHelper

  Layout = Thinreports::Layout

  def test_load_format
    assert_instance_of Layout::Format,
                       Layout::Base.load_format(data_file('layout_text1.tlf'))
    assert_instance_of Layout::Format,
                       Layout::Base.load_format(data_file('layout_text1'))

    assert_raises Thinreports::Errors::LayoutFileNotFound do
      Layout::Base.load_format 'unknown.tlf'
    end
  end

  def test_new
    layout = create_layout id: 'foo'

    assert_equal 'foo', layout.id
    assert_equal data_file('layout_text1.tlf'), layout.filename
  end

  def test_default?
    assert_equal false, create_layout(id: 'foo').default?
    assert_equal true, create_layout.default?
  end

  def test_config
    assert_instance_of Thinreports::Layout::Configuration,
                       create_layout.config
  end

  def test_new_page
    report = new_report 'layout_text1'
    assert_instance_of Thinreports::Report::Page,
                       create_layout.new_page(report)
  end

  def create_layout(options = {})
    Layout::Base.new data_file('layout_text1.tlf'), options
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.8.2 test/unit/layout/test_base.rb
thinreports-0.8.1 test/unit/layout/test_base.rb
thinreports-0.8.0 test/unit/layout/test_base.rb