Sha256: 73c66bc4ac59682f071ba88bfad0ee442f148e81c908da0a12efc5754fe4ed59

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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(layout_file.path)
    assert_raises Thinreports::Errors::LayoutFileNotFound do
      Layout::Base.load_format 'unknown.tlf'
    end
  end

  def test_new
    layout_filename = layout_file.path
    layout = Layout::Base.new(layout_filename)

    assert_nil layout.id
    assert_equal layout_filename, layout.filename
    assert_instance_of Layout::Format, layout.format
  end

  def test_id
    layout_without_id = Layout::Base.new(layout_file.path)
    assert_nil layout_without_id.id

    layout_with_id = Layout::Base.new(layout_file.path, id: 'foo')
    assert_equal 'foo', layout_with_id.id
  end

  def test_default?
    layout_without_id = Layout::Base.new(layout_file.path)
    assert_equal true, layout_without_id.default?

    layout_with_id = Layout::Base.new(layout_file.path, id: 'bar')
    assert_equal false, layout_with_id.default?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.9.1 test/unit/layout/test_base.rb
thinreports-0.9.0 test/unit/layout/test_base.rb