Sha256: 0b4859bbb44a96e6c6c3676dc55a135c1b17ac02936711e1c01d008eeee8a238

Contents?: true

Size: 936 Bytes

Versions: 18

Compression:

Stored size: 936 Bytes

Contents

require 'test/unit'
require 'axlsx.rb'

class TestCore < Test::Unit::TestCase
  
  def setup    
    @core = Axlsx::Core.new
    @doc = Nokogiri::XML(@core.to_xml)
  end

  def test_valid_document
    schema = Nokogiri::XML::Schema(File.open(Axlsx::CORE_XSD))
    errors = []
    schema.validate(@doc).each do |error|
      puts error.message
      errors << error
    end
    assert_equal(errors.size, 0, "core.xml Invalid" + errors.map{ |e| e.message }.to_s)
  end

  def test_populates_created
    assert_equal(@doc.xpath('//dcterms:created').text, Time.now.strftime('%Y-%m-%dT%H:%M:%S'), "dcterms:created incorrect")
  end
 
  def test_populates_default_name
    assert_equal(@doc.xpath('//dc:creator').text, "axlsx", "Default name not populated")
  end

  def test_creator_as_option
    c = Axlsx::Core.new :creator => "some guy"
    doc = Nokogiri::XML(c.to_xml)
    assert(doc.xpath('//dc:creator').text == "some guy")
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
axlsx-1.0.18 test/doc_props/tc_core.rb
axlsx-1.0.17 test/doc_props/tc_core.rb
axlsx-1.0.16 test/doc_props/tc_core.rb
axlsx-1.0.15 test/doc_props/tc_core.rb
axlsx-1.0.14 test/doc_props/tc_core.rb
axlsx-1.0.12 test/doc_props/tc_core.rb
axlsx-1.0.11 test/doc_props/tc_core.rb
axlsx-1.0.10 test/doc_props/tc_core.rb
axlsx-1.0.10a test/doc_props/tc_core.rb
axlsx-1.0.9 test/doc_props/tc_core.rb
axlsx-1.0.8 test/doc_props/tc_core.rb
axlsx-1.0.7 test/doc_props/tc_core.rb
axlsx-1.0.6 test/doc_props/tc_core.rb
axlsx-1.0.5 test/doc_props/tc_core.rb
axlsx-1.0.4 test/doc_props/tc_core.rb
axlsx-1.0.3 test/doc_props/tc_core.rb
axlsx-1.0.1 test/doc_props/tc_core.rb
axlsx-1.0.0 test/doc_props/tc_core.rb