Sha256: a9e7676692b74663fa1780e981ff2b3ff94a99a89db0a4484597da45b6f34287

Contents?: true

Size: 890 Bytes

Versions: 7

Compression:

Stored size: 890 Bytes

Contents

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

class TestRelationships < Test::Unit::TestCase
  def setup    
    @rels = Axlsx::Relationships.new
  end
  
  def teardown    
  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_relationships.rb~
axlsx-1.0.6 test/rels/tc_relationships.rb~
axlsx-1.0.5 test/rels/tc_relationships.rb~
axlsx-1.0.4 test/rels/tc_relationships.rb~
axlsx-1.0.3 test/rels/tc_relationships.rb~
axlsx-1.0.1 test/rels/tc_relationships.rb~
axlsx-1.0.0 test/rels/tc_relationships.rb~