Sha256: 6ffb23e99f71503ef143712e5d94867d785259cf170e21ce59f1deb1f4ce9c08

Contents?: true

Size: 1.76 KB

Versions: 19

Compression:

Stored size: 1.76 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'write_xlsx/package/core'

class TestCore02 < Minitest::Test
  def test_assemble_xml_file
    properties = {
      :title    => 'This is an example spreadsheet',
      :subject  => 'With document properties',
      :author   => 'John McNamara',
      :manager  => 'Dr. Heinz Doofenshmirtz',
      :company  => 'of Wolves',
      :category => 'Example spreadsheets',
      :keywords => 'Sample, Example, Properties',
      :comments => 'Created with Ruby and WriteXLSX',
      :status   => 'Quo',
      :created  => Time.local(2011, 4, 6, 19, 45, 15)
    }

    @obj = Writexlsx::Package::Core.new
    @obj.set_properties(properties)
    @obj.assemble_xml_file
    result = got_to_array(@obj.xml_str)
    expected = expected_to_array(<<EOS
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <dc:title>This is an example spreadsheet</dc:title>
  <dc:subject>With document properties</dc:subject>
  <dc:creator>John McNamara</dc:creator>
  <cp:keywords>Sample, Example, Properties</cp:keywords>
  <dc:description>Created with Ruby and WriteXLSX</dc:description>
  <cp:lastModifiedBy>John McNamara</cp:lastModifiedBy>
  <dcterms:created xsi:type="dcterms:W3CDTF">2011-04-06T19:45:15Z</dcterms:created>
  <dcterms:modified xsi:type="dcterms:W3CDTF">2011-04-06T19:45:15Z</dcterms:modified>
  <cp:category>Example spreadsheets</cp:category>
  <cp:contentStatus>Quo</cp:contentStatus>
</cp:coreProperties>
EOS
    )
    assert_equal(expected, result)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
write_xlsx-1.09.4 test/package/core/test_core02.rb
write_xlsx-1.09.3 test/package/core/test_core02.rb
write_xlsx-1.09.2 test/package/core/test_core02.rb
write_xlsx-1.09.1 test/package/core/test_core02.rb
write_xlsx-1.09.0 test/package/core/test_core02.rb
write_xlsx-1.08.2 test/package/core/test_core02.rb
write_xlsx-1.08.1 test/package/core/test_core02.rb
write_xlsx-1.08.0 test/package/core/test_core02.rb
write_xlsx-1.07.0 test/package/core/test_core02.rb
write_xlsx-1.04.0 test/package/core/test_core02.rb
write_xlsx-1.02.0 test/package/core/test_core02.rb
write_xlsx-1.01.0 test/package/core/test_core02.rb
write_xlsx-1.00.0 test/package/core/test_core02.rb
write_xlsx-0.99.0 test/package/core/test_core02.rb
write_xlsx-0.97.0 test/package/core/test_core02.rb
write_xlsx-0.90.0 test/package/core/test_core02.rb
write_xlsx-0.89.0 test/package/core/test_core02.rb
write_xlsx-0.88.0 test/package/core/test_core02.rb
write_xlsx-0.87.0 test/package/core/test_core02.rb