Sha256: 09a0d5e77818b16e0d1ce205746cd84f23b69265869f13717f649c60da7a1f61

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

# coding: utf-8

require 'test_helper'

class Thinreports::Core::Shape::Manager::TestFormat < Minitest::Test
  include Thinreports::TestHelper

  class TestFormat < Thinreports::Core::Shape::Manager::Format; end

  def test_identifier_should_return_the_same_as_object_id_when_id_is_not_given
    format = TestFormat.new({})
    assert_equal format.identifier, format.object_id
  end

  def test_identifier_should_return_the_specified_id_when_id_is_given
    assert_equal TestFormat.new({}, :any_id).identifier, :any_id
  end

  def test_has_shape
    format = TestFormat.new({}) do |f|
      f.shapes[:foo] = 1
    end
    assert format.has_shape?(:foo)
    refute format.has_shape?(:unknown)
  end

  def test_find_shape_should_return_format_of_shape_when_shape_is_found
    format = TestFormat.new({}) do |f|
      f.shapes[:foo] = Thinreports::Core::Shape::TextBlock::Format.new('id'   => 'foo',
                                                                       'type' => 's-tblock')
    end
    assert_equal format.find_shape(:foo).id, 'foo'
  end

  def test_find_shape_should_return_nil_when_shape_is_not_found
    assert_nil TestFormat.new({}).find_shape(:unknown)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.8.2 test/unit/core/shape/manager/test_format.rb