Sha256: 8c8bfe741ae7c5bcc6e056767ef7b513f43dec0b06da9f115bfc43677bef65bf

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require "assert"

require "osheet/column"

module Osheet

  class ColumnTests < Assert::Context
    desc "a Column"
    before { @c = Column.new }
    subject { @c }

    should be_a_styled_element
    should be_a_meta_element

    should have_reader :format
    should have_instance_methods :width
    should have_instance_methods :autofit, :autofit?
    should have_instance_methods :hidden, :hidden?

    should "set it's defaults" do
      assert_equal nil, subject.width
      assert_equal false, subject.autofit
      assert !subject.autofit?
      assert_equal false, subject.hidden
      assert !subject.hidden?
      assert_kind_of Format::General, subject.format
    end

    should "set it's width" do
      subject.width(false)
      assert_equal false, subject.width

      subject.width(180)
      assert_equal 180, subject.width

      subject.width(nil)
      assert_equal 180, subject.width

      assert_equal 200, Column.new(200).width
    end

    should "cast autofit and hidden to bool" do
      col = Column.new
      col.autofit :true
      col.hidden 'false'

      assert_equal true, col.autofit
      assert_equal true, col.hidden
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
osheet-1.0.0.rc.4 test/column_test.rb
osheet-1.0.0.rc.3 test/column_test.rb
osheet-1.0.0.rc.2 test/column_test.rb
osheet-1.0.0.rc.1 test/column_test.rb