# 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 Characteristic < ItemProxy describe self do before(:all) do @tm = get_used_tm_sys_tm @topic = @tm.get!("person") @name_value = "Hans" @occ_value = "18" @name = @topic.create_name(@name_value) @occ = @topic.create_occurrence("Age", @occ_value) @name_proxy = @name.axes @occ_proxy = @occ.axes end after(:all) do @tm.close end it "should be allowed to call #tmapi and #result on a RTM::TQML::Name" do @name_proxy.methods.should include("tmapi") @name_proxy.methods.should include("result") end it "should be allowed to call #atomify on a RTM::TQML::Name" do @name_proxy.methods.should include("atomify") end it "should be allowed to call #reverse_characteristics on a RTM::TQML::Name" do @name_proxy.methods.should include("reverse_characteristics") end it "should be allowed to call #reverse_reifier on a RTM::TQML::Name" do @name_proxy.methods.should include("reverse_reifier") end it "should be allowed to call #scope on a RTM::TQML::Name" do @name_proxy.methods.should include("scope") end it "should be allowed to call #tmapi and #result on a RTM::TQML::Occurrence" do @occ_proxy.methods.should include("tmapi") @occ_proxy.methods.should include("result") end it "should be allowed to call #atomify on a RTM::TQML::Occurrence" do @occ_proxy.methods.should include("atomify") end it "should be allowed to call #reverse_characteristics on a RTM::TQML::Occurrence" do @occ_proxy.methods.should include("reverse_characteristics") end it "should be allowed to call #reverse_reifier on a RTM::TQML::Occurrence" do @occ_proxy.methods.should include("reverse_reifier") end it "should be allowed to call #scope on a RTM::TQML::Occurrence" do @occ_proxy.methods.should include("scope") end describe "#new" do it "should raise an error if the underlying construct is not a RTM::Name or RTM::Occurrence" do lambda{RTM::Axes::Name.new(1,@tm)}.should raise_error lambda{RTM::Axes::Occurrence.new(1,@tm)}.should raise_error end it "should not raise an error if the underlying construct is a RTM::Name or RTM::Occurrence" do lambda{RTM::Axes::Name.new(@name,@tm)}.should_not raise_error lambda{RTM::Axes::Occurrence.new(@occ,@tm)}.should_not raise_error end end describe "#atomify" do it "should give back a RTM::Axes::String" do @name_proxy.atomify.should be_a_kind_of RTM::Axes::String @occ_proxy.atomify.should be_a_kind_of RTM::Axes::String end it "should give back the values" do @name_proxy.atomify.construct.should == @name_value @occ_proxy.atomify.construct.should == @occ_value end end describe "#reverse_characteristics" do it "should give back a RTM::Axes::Topic" do @name_proxy.reverse_characteristics.should be_a_kind_of(RTM::Axes::Topic) @occ_proxy.reverse_characteristics.should be_a_kind_of(RTM::Axes::Topic) end it "should give back the righ Topic" do @name_proxy.reverse_characteristics.construct.should == @topic @occ_proxy.reverse_characteristics.construct.should == @topic end end end end end