Sha256: 443d739c1ae70a294af9301d411650953785fbeece9b007adf8a3d3a7dccd33d

Contents?: true

Size: 1 KB

Versions: 19

Compression:

Stored size: 1 KB

Contents

require 'tc_helper.rb'

class TestRelationships < Test::Unit::TestCase

  def test_for
    source_obj_1, source_obj_2 = Object.new, Object.new
    rel_1 = Axlsx::Relationship.new(source_obj_1, Axlsx::WORKSHEET_R, "bar")
    rel_2 = Axlsx::Relationship.new(source_obj_2, Axlsx::WORKSHEET_R, "bar")
    rels = Axlsx::Relationships.new
    rels << rel_1 
    rels << rel_2
    assert_equal rel_1, rels.for(source_obj_1)
    assert_equal rel_2, rels.for(source_obj_2)
  end
  
  def test_valid_document
    @rels = Axlsx::Relationships.new
    schema = Nokogiri::XML::Schema(File.open(Axlsx::RELS_XSD))
    doc = Nokogiri::XML(@rels.to_xml_string)
    errors = []
    schema.validate(doc).each do |error|
      puts error.message
      errors << error
    end

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

    assert(errors.size == 0)
  end

end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
caxlsx-3.1.1 test/rels/tc_relationships.rb
caxlsx-3.1.0 test/rels/tc_relationships.rb
bonio-axlsx-2.2.3 test/rels/tc_relationships.rb
caxlsx-3.0.4 test/rels/tc_relationships.rb
caxlsx-3.0.3 test/rels/tc_relationships.rb
caxlsx-3.0.2 test/rels/tc_relationships.rb
caxlsx-2.0.2 test/rels/tc_relationships.rb
caxlsx-3.0.1 test/rels/tc_relationships.rb
caxlsx-3.0.0 test/rels/tc_relationships.rb
axlsx-alt-3.0.1 test/rels/tc_relationships.rb
axlsx-alt-3.0.0 test/rels/tc_relationships.rb
axlsx-3.0.0.pre test/rels/tc_relationships.rb
bonio-axlsx-2.2.2 test/rels/tc_relationships.rb
bonio-axlsx-2.2.1 test/rels/tc_relationships.rb
dg-axlsx-2.1.0 test/rels/tc_relationships.rb
axlsx-2.1.0.pre test/rels/tc_relationships.rb
l_axlsx-2.0.1 test/rels/tc_relationships.rb
axlsx-2.0.1 test/rels/tc_relationships.rb
axlsx-2.0.0 test/rels/tc_relationships.rb