Sha256: 99ffc490716510499497bd5319221542dde1e01a47117d28d96cfc85f72e708b

Contents?: true

Size: 1.12 KB

Versions: 14

Compression:

Stored size: 1.12 KB

Contents

# encoding: UTF-8
require 'tc_helper.rb'

class TestDefault < Test::Unit::TestCase

  def test_initialization_requires_Extension_and_ContentType
    assert_raise(ArgumentError, "raises argument error if Extension and/or ContentType are not specified") { Axlsx::Default.new }
    assert_raise(ArgumentError, "raises argument error if Extension and/or ContentType are not specified") { Axlsx::Default.new :Extension=>"xml" }
    assert_raise(ArgumentError, "raises argument error if Extension and/or ContentType are not specified") { Axlsx::Default.new :ContentType=>"asdf" }

    assert_nothing_raised {Axlsx::Default.new :Extension=>"foo", :ContentType=>Axlsx::XML_CT}

  end
  def test_content_type_restriction
    assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType=>"asdf" }
  end

  def test_to_xml_string
    type = Axlsx::Default.new :Extension=>"xml", :ContentType=>Axlsx::XML_CT
    doc = Nokogiri::XML(type.to_xml_string)
    assert_equal(doc.xpath("Default[@ContentType='#{Axlsx::XML_CT}']").size, 1)
    assert_equal(doc.xpath("Default[@Extension='xml']").size, 1)

  end


end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
axlsx-1.3.1 test/content_type/tc_default.rb
axlsx-1.2.3 test/content_type/tc_default.rb
axlsx-1.2.2 test/content_type/tc_default.rb
axlsx-1.2.1 test/content_type/tc_default.rb
axlsx-1.2.0 test/content_type/tc_default.rb
axlsx-1.1.8 test/content_type/tc_default.rb
axlsx-1.1.7 test/content_type/tc_default.rb
axlsx-1.1.6 test/content_type/tc_default.rb
axlsx-1.1.5 test/content_type/tc_default.rb
axlsx-1.1.4 test/content_type/tc_default.rb
axlsx-1.1.3 test/content_type/tc_default.rb
axlsx-1.1.2 test/content_type/tc_default.rb
axlsx-1.1.1 test/content_type/tc_default.rb
axlsx-1.1.0 test/content_type/tc_default.rb