Sha256: 6ffea4d631b95618da8ba88802bdb92e696a19e68f4bc697a04cdecae32938a1

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Core::Shape::Tblock::TestInterface < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers
  
  Tblock = ThinReports::Core::Shape::Tblock
  
  def setup
    @interface = Tblock::Interface.new(flexmock('parent'), flexmock('format'))
  end
  
  def test_value_work_as_getter_when_receive_no_arguments
    flexmock(@interface.internal).should_receive(:read_value).
        and_return('value').once
    
    assert_equal @interface.value, 'value'
  end
  
  def test_value_work_as_setter_when_receive_an_just_one_argument
    flexmock(@interface.internal).should_receive(:write_value).once
    
    @interface.value('any value')
  end
  
  def test_value_raise_error_when_receive_more_than_two
    assert_raises ArgumentError do
      @interface.value('arg1', 'arg2')
    end
  end
  
  def test_set
    flexmock(@interface).
        should_receive(:value).once.
        should_receive(:styles).once
    
    @interface.set('value', :fill => 'red')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 test/unit/core/shape/tblock/test_interface.rb