Sha256: 991445e5f251310b1bbfb4e498f2a32fd5ed8d55537e347650a0dc08949d70e1

Contents?: true

Size: 1013 Bytes

Versions: 2

Compression:

Stored size: 1013 Bytes

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_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

2 entries across 2 versions & 1 rubygems

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