summaryrefslogtreecommitdiffhomepage
path: root/test/content_type/tc_default.rb
blob: d9ae1dd3299b6cf34d32de2ac217a2bb10a9e05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'tc_helper'

class TestDefault < Test::Unit::TestCase
  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(1, doc.xpath("Default[@ContentType='#{Axlsx::XML_CT}']").size)
    assert_equal(1, doc.xpath("Default[@Extension='xml']").size)
  end
end