Sha256: 7c1eeb79ad7ff49fb1f75c6d66cea779b7a842711076cdba582a50c0e36eda34

Contents?: true

Size: 950 Bytes

Versions: 7

Compression:

Stored size: 950 Bytes

Contents

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

class TestRelationships < Test::Unit::TestCase
  def setup    
  end
  
  def teardown    
  end  

  def test_type
    assert_raise(ArgumentError) { Axlsx::Relationship.new 'type', 'target'
  end
  def test_valid_document
    schema = Nokogiri::XML::Schema(File.open(Axlsx::RELS_XSD))
    doc = Nokogiri::XML(@rels.to_xml)
    errors = []
    schema.validate(doc).each do |error|
      puts error.message
      errors << error
    end

    @rels << Axlsx::Relationship.new(Axlsx::WORKSHEET_R, "bar")
    doc = Nokogiri::XML(@rels.to_xml)
    errors = []
    schema.validate(doc).each do |error|
      puts error.message
      errors << error
    end

    assert(errors.size == 0)    
  end

  def test_require_valid_relationship_type
    assert_raise(ArgumentError) { Axlsx::Relationship.new("Unknown", "bar" ) }    
    assert_nothing_raised { Axlsx::Relationship.new(Axlsx::CHART_R, "bar") }    
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
axlsx-1.0.7 test/rels/tc_relationship.rb~
axlsx-1.0.6 test/rels/tc_relationship.rb~
axlsx-1.0.5 test/rels/tc_relationship.rb~
axlsx-1.0.4 test/rels/tc_relationship.rb~
axlsx-1.0.3 test/rels/tc_relationship.rb~
axlsx-1.0.1 test/rels/tc_relationship.rb~
axlsx-1.0.0 test/rels/tc_relationship.rb~