Sha256: d7c7816d7f972c5907cb3db97d354e419b08a61c8b7346f0a51f17c58f874d56

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Core::Shape::List::TestSectionInterface < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers
  
  # Alias
  List = ThinReports::Core::Shape::List
  
  def setup
    parent = flexmock('parent')
    format = flexmock('format')
    
    @interface = List::SectionInterface.new(parent, format, :section)
  end
  
  def test_undef_list_method
    refute_respond_to @interface, :list
  end
  
  def test_internal
    assert_instance_of List::SectionInternal, @interface.internal
  end
  
  def test_properly_set_init_item_handler
    shape_format = flexmock('shape_format')
    
    flexmock(ThinReports::Core::Shape).
      should_receive(:Interface).with(@interface, shape_format).once
      
    @interface.manager.init_item(shape_format)
  end
  
  def test_copy
    original_foo = flexmock('original_foo')
    copied_foo   = flexmock('copied_foo')

    flexmock(original_foo).
      should_receive(:copy).and_return(copied_foo).once
    @interface.manager.shapes[:foo] = original_foo
    
    copied_interface = @interface.copy(flexmock('new_parent'))
    
    assert_instance_of List::SectionInterface, copied_interface
    refute_equal @interface.object_id, copied_interface.object_id
    
    assert_equal copied_interface.internal.section_name,
                 @interface.internal.section_name
    assert_same copied_interface.manager.shapes[:foo], copied_foo
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 test/unit/core/shape/list/test_section_interface.rb