# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../../spec_helper' module RTM::Axes module Topics describe self do before(:all) do @tm = get_used_tm_sys_tm @topic1 = @tm.get!("person1") @name1 = @topic1.create_name("Hans") @occ1 = @topic1.create_occurrence("Age", "18") @topic2 = @tm.get!("person2") @name2 = @topic2.create_name("Peter") @occ2 = @topic2.create_occurrence("Age", "17") @proxy = [@topic1.axes,@topic2.axes].extend(Topics) end after(:all) do @tm.close end it "should be allowed to call #tmapi and #result on a RTM::TQML::Topics" do @proxy.methods.should include("tmapi") @proxy.methods.should include("result") end it "should be allowed to call #characteristics on a RTM::TQML::Topics" do @proxy.methods.should include("characteristics") end it "should be allowed to call #indicators on a RTM::TQML::Topics" do @proxy.methods.should include("indicators") end it "should be allowed to call #item on a RTM::TQML::Topics" do @proxy.methods.should include("item") end it "should be allowed to call #locators on a RTM::TQML::Topics" do @proxy.methods.should include("locators") end it "should be allowed to call #reverse_players on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_players") end it "should be allowed to call #reifier on a RTM::TQML::Topics" do @proxy.methods.should include("reifier") end it "should be allowed to call #reverse_roles on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_roles") end it "should be allowed to call #reverse_scope on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_scope") end it "should be allowed to call #supertypes on a RTM::TQML::Topicsy" do @proxy.methods.should include("supertypes") end it "should be allowed to call #subtypes on a RTM::TQML::Topics" do @proxy.methods.should include("subtypes") end it "should be allowed to call #reverse_subtypes on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_subtypes") end it "should be allowed to call #reverse_supertypes on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_supertypes") end it "should be allowed to call #traverse on a RTM::TQML::Topics" do @proxy.methods.should include("traverse") end it "should be allowed to call #reverse_traverse on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_traverse") end it "should be allowed to call #types on a RTM::TQML::Topics" do @proxy.methods.should include("types") end it "should be allowed to call #instances on a RTM::TQML::Topics" do @proxy.methods.should include("instances") end it "should be allowed to call #reverse_types on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_types") end it "should be allowed to call #reverse_instances on a RTM::TQML::Topics" do @proxy.methods.should include("reverse_instances") end describe "#characteristics" do it "should give back an Array" do @proxy.characteristics.should be_a_kind_of Array end it "should give back an Array consisting of RTM::Axes::Characteristic" do @proxy.characteristics.first.should be_a_kind_of RTM::Axes::Characteristic end it "should give back a RTM::Axes::Characteristics" do @proxy.characteristics.should be_a_kind_of RTM::Axes::Characteristics end it "should give back all Names and Occurrences of this Topic" do @proxy.characteristics.size.should == 4 @proxy.characteristics.map{|c| c.construct}.should include(@name1) @proxy.characteristics.map{|c| c.construct}.should include(@occ1) @proxy.characteristics.map{|c| c.construct}.should include(@name2) @proxy.characteristics.map{|c| c.construct}.should include(@occ2) end end end end end