Sha256: f5733e4f4a821e760ceccb221a72b8abd516331b17620b51be263433a30b0a00

Contents?: true

Size: 1.1 KB

Versions: 32

Compression:

Stored size: 1.1 KB

Contents

require 'tc_helper.rb'

class TestTableStyle < Test::Unit::TestCase

  def setup
    @item = Axlsx::TableStyle.new "fisher"
  end

  def teardown
  end

  def test_initialiation
    assert_equal(@item.name, "fisher")
    assert_equal(@item.pivot, nil)
    assert_equal(@item.table, nil)
    ts = Axlsx::TableStyle.new 'price', :pivot => true, :table => true
    assert_equal(ts.name, 'price')
    assert_equal(ts.pivot, true)
    assert_equal(ts.table, true)
  end

  def test_name
    assert_raise(ArgumentError) { @item.name = -1.1 }
    assert_nothing_raised { @item.name = "lovely table style" }
    assert_equal(@item.name, "lovely table style")
  end

  def test_pivot
    assert_raise(ArgumentError) { @item.pivot = -1.1 }
    assert_nothing_raised { @item.pivot = true }
    assert_equal(@item.pivot, true)
  end

  def test_table
    assert_raise(ArgumentError) { @item.table = -1.1 }
    assert_nothing_raised { @item.table = true }
    assert_equal(@item.table, true)
  end

  def test_to_xml_string
    doc = Nokogiri::XML(@item.to_xml_string)
    assert(doc.xpath("//tableStyle[@name='#{@item.name}']"))
  end
end

Version data entries

32 entries across 32 versions & 6 rubygems

Version Path
caxlsx-3.1.1 test/stylesheet/tc_table_style.rb
caxlsx-3.1.0 test/stylesheet/tc_table_style.rb
bonio-axlsx-2.2.3 test/stylesheet/tc_table_style.rb
caxlsx-3.0.4 test/stylesheet/tc_table_style.rb
caxlsx-3.0.3 test/stylesheet/tc_table_style.rb
caxlsx-3.0.2 test/stylesheet/tc_table_style.rb
caxlsx-2.0.2 test/stylesheet/tc_table_style.rb
caxlsx-3.0.1 test/stylesheet/tc_table_style.rb
caxlsx-3.0.0 test/stylesheet/tc_table_style.rb
axlsx-alt-3.0.1 test/stylesheet/tc_table_style.rb
axlsx-alt-3.0.0 test/stylesheet/tc_table_style.rb
axlsx-3.0.0.pre test/stylesheet/tc_table_style.rb
bonio-axlsx-2.2.2 test/stylesheet/tc_table_style.rb
bonio-axlsx-2.2.1 test/stylesheet/tc_table_style.rb
dg-axlsx-2.1.0 test/stylesheet/tc_table_style.rb
axlsx-2.1.0.pre test/stylesheet/tc_table_style.rb
l_axlsx-2.0.1 test/stylesheet/tc_table_style.rb
axlsx-2.0.1 test/stylesheet/tc_table_style.rb
axlsx-2.0.0 test/stylesheet/tc_table_style.rb
axlsx-1.3.6 test/stylesheet/tc_table_style.rb