Sha256: 01230177e467258f09bab86ff27e8bf205fa0ade24195f06f42286e864f360ea

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

require 'tc_helper.rb'

class TestDataSource < Test::Unit::TestCase

  def setup
    @str_data = Axlsx::DataSource.new :data => ["1", "2", "3"]
  end

  def test_tag_name
    assert_raise(ArgumentError) { @str_data.tag_name = :bob}
    assert_nothing_raised { @str_data.tag_name = :strCache}
  end
  def test_initialize
    assert_equal(@str_data.pt.size, 3)
    assert(@str_data.pt.is_a? Axlsx::SimpleTypedList)
    assert_equal(@str_data.tag_name, :strLit)
  end


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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
axlsx-1.1.7 test/drawing/tc_data_source.rb~
axlsx-1.1.6 test/drawing/tc_data_source.rb~
axlsx-1.1.5 test/drawing/tc_data_source.rb~
axlsx-1.1.4 test/drawing/tc_data_source.rb~