# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestTable09 < Test::Unit::TestCase def setup workbook = WriteXLSX.new(StringIO.new) @worksheet = workbook.add_worksheet end def test_table09 # Set the table properties. @worksheet.add_table( 'B2:K8', { :total_row => 1, :columns => [ {:total_string => 'Total'}, {}, {:total_function => 'Average'}, {:total_function => 'COUNT'}, {:total_function => 'count_nums'}, {:total_function => 'max'}, {:total_function => 'min'}, {:total_function => 'sum'}, {:total_function => 'std Dev'}, {:total_function => 'var'} ] } ) @worksheet.__send__(:prepare_tables, 1) table = @worksheet.tables[0] table.__send__(:assemble_xml_file) result = got_to_array(table.instance_variable_get(:@writer).string) assert_equal(expected, result) end def expected expected_to_array( <
EOS ) end end