Sha256: b6c931e161cb74418a9caf6d25ecfbc6ef573a5bdead4019839b64307a714ba0

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.10.3 test/units/layout/test_base.rb
thinreports-0.10.2 test/unit/layout/test_base.rb
thinreports-0.10.1 test/unit/layout/test_base.rb
thinreports-0.10.0 test/unit/layout/test_base.rb