Sha256: 9e64e61b5e931cd328548656cb758e97bf63b8125dc52ae3765e326a1dc196b9
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require 'tc_helper.rb' class TestPivotTableCacheDefinition < Test::Unit::TestCase def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet 5.times do @ws << ["aa","aa","aa","aa"] end @pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5') @cache_definition = @pivot_table.cache_definition end def test_initialization assert(@cache_definition.is_a?(Axlsx::PivotTableCacheDefinition), "must create a pivot table cache definition") assert_equal(@pivot_table, @cache_definition.pivot_table, 'refers back to its pivot table') end def test_pn assert_equal('pivotCache/pivotCacheDefinition1.xml', @cache_definition.pn) end def test_rId assert_equal('rId1', @cache_definition.rId) end def test_index assert_equal(0, @cache_definition.index) end def test_cache_id assert_equal(1, @cache_definition.cache_id) end def test_to_xml_string schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(@cache_definition.to_xml_string) errors = [] schema.validate(doc).each do |error| errors.push error puts error.message end assert(errors.empty?, "error free validation") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axlsx-1.3.6 | test/workbook/worksheet/tc_pivot_table_cache_definition.rb |
axlsx-1.3.5 | test/workbook/worksheet/tc_pivot_table_cache_definition.rb |