Sha256: 1db4bd9616832ac488fe42ef675e8aa4d9b5a559de2e48531de9af37c93f9552

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

require File.dirname(__FILE__) + '/../../../spec_helper'

module RTM::Navigation::Topic
  
  describe "characteristics" do
    before(:each) do
      @tm = get_used_tm_sys_tm
      @topic = @tm.get!("Person")
    end
    after(:each) do
      @tm.close
    end
    
    describe "#characteristics" do
      it "should give back an empty set if nothing matches" do
        topic = @tm.create_topic_by("Uni_Leipzig")
        topic.characteristics.size.should == 0
        occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
        topic.characteristics("super_Gruendungsjahr").size.should == 0
      end
      it "should give back the values of the Names and Occurrences included in Characteristics" do
        topic = @tm.create_topic_by("Uni_Leipzig")
        name1 = topic.create_name("Universität Leipzig")
        name2 = topic.create_name("University of Leipzig")
        occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
        occ2 = topic.create_occurrence("Webseite", "http://www.topicmapslab.de")
        topic.characteristics.size.should == 4
        topic.characteristics.should include name1, name2, occ1, occ2
      end

      it "should give back  Names and Occurrences with a type of the subtype of the given argument" do
        topic = @tm.get!("Uni_Leipzig")
        name = topic.create_name("university name", "Universität Leipzig")
        @tm.get!("name").add_subtype("university name")
        topic.characteristics("name").size.should == 1
        topic.characteristics("name").should include(name)
        occ = topic.create_occurrence("Gruendungsjahr", "1409")
        @tm.get!("Jahr").add_subtype("Gruendungsjahr")
        topic.characteristics("Jahr").size.should == 1
        topic.characteristics("Jahr").should include(occ)
      end
      
    end #of describe "#characteristics"
    
  end #of describe "characteristics"
  
end #of module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.3.1 spec/rtm/navigation/topic/characteristics_spec.rb