# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../../spec_helper' module RTM::Axes class Association < ItemProxy describe self do before(:all) do @tm = get_used_tm_sys_tm @topic = @tm.get!("person") @assoc = @tm.create_association("assoc_type") @proxy = @assoc.axes end after(:all) do @tm.close end it "should be allowed to call #tmapi and #result on a RTM::Axes::Association" do @proxy.methods.should include("tmapi") @proxy.methods.should include("result") end it "should be allowed to call #players on a RTM::Axes::Association" do @proxy.methods.should include("players") end it "should be allowed to call #reverse_reifier on a RTM::Axes::Association" do @proxy.methods.should include("reverse_reifier") end it "should be allowed to call #roles on a RTM::Axes::Association" do @proxy.methods.should include("roles") end it "should be allowed to call #scope on a RTM::Axes::Association" do @proxy.methods.should include("scope") end it "should be allowed to call #reverse_traverse on a RTM::Axes::Association" do pending "should not" do @proxy.methods.should include("reverse_traverse") end end describe "#new" do it "should raise an error if the underlying construct is not an Association" do lambda{RTM::Axes::Association.new(1,@tm)}.should raise_error end it "should not raise an error if the underlying construct is an Association" do lambda{RTM::Axes::Association.new(@assoc,@tm)}.should_not raise_error end end describe "#players" do end describe "#reverse_reifier" do end describe "#roles" do # it "should give back an empty set if the association has no roles" do # a_asso = @tm.create_association("asso_type") # a_asso.roles.should be_empty # end # it "should give back the role types of the association" do # a_asso = @tm.create_association("asso_type") # a_asso["a_role_type"] = "to_a_noter_topic" # a_asso.roles_tta.size.should == 1 # a_asso["another_role_type"] = "to_another_noter_topic" # a_asso.roles_tta.size.should == 2 # a_asso.roles_tta.include?(@tm.get("a_role_type")).should == true # a_asso.roles_tta.include?(@tm.get("another_role_type")).should == true # end # it "should give back multiple roll-typing topics if the the same role type is used multiple times" do # a_asso = @tm.create_association("asso_type") # a_asso["a_role_type"] = "to_a_noter_topic" # a_asso.roles_tta.size.should == 1 # a_asso["a_role_type"] = "to_another_noter_topic" # a_asso.roles_tta.size.should == 2 # a_asso.roles_tta.include?(@tm.get("a_role_type")).should == true # a_asso.roles_tta.select {|t| t == @tm.get("a_role_type")}.size.should == 2 # end end describe "#scope" do end end end end