Sha256: 7a91e2bce3d2ec54e26b1ed0d68162d1af8dc34e9afcc213de6ec8cc333953c9

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

require 'tc_helper.rb'

class TestNumData < Test::Unit::TestCase

  def setup
    @num_data = Axlsx::NumData.new :data => [1, 2, 3]
  end

  def test_initialize
    assert_equal(@num_data.format_code, "General")
  end

  def test_format_code
    assert_raise(ArgumentError) {@num_data.format_code = 7}
    assert_nothing_raised {@num_data.format_code = 'foo_bar'}
  end

  def test_to_xml_string
    str = '<?xml version="1.0" encoding="UTF-8"?>'
    str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">'
    str << @num_data.to_xml_string
    doc = Nokogiri::XML(str)
    assert_equal(doc.xpath("//c:numLit/c:ptCount[@val=3]").size, 1)
    assert_equal(doc.xpath("//c:numLit/c:pt/c:v[text()='1']").size, 1)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axlsx-1.1.6 test/drawing/tc_num_data.rb
axlsx-1.1.5 test/drawing/tc_num_data.rb
axlsx-1.1.4 test/drawing/tc_num_data.rb