# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../spec_helper' module RTM describe "JavaTMAPI" do describe "#create" do it "should give always give back the same topic map" do tm_identifier = "http://www.exampl.org/test/" engine = RTM.connect(:implementation => implementation_for_spec) tm = engine.create(tm_identifier) 1000.times do tm_other = engine.create(tm_identifier) tm_other.should == tm tm_other.engine.should_not be_nil tm_other.prefixes.should_not be_empty end end it "should raise an error if topic map identifier is relative" do tm_identifier = "www.exampl.org/test/" engine = RTM.connect(:implementation => implementation_for_spec) if implementation_for_spec == :tinytim pending do lambda{engine.create(tm_identifier)}.should raise_error end else lambda{engine.create(tm_identifier)}.should raise_error end end it "should be tested" end describe "#delete" do it "should delete a topic map" do tm_identifier = "http://www.exampl.org/test/" engine = RTM.connect(:implementation => implementation_for_spec) tm = engine.create(tm_identifier) tm.should be_a_kind_of RTM::TopicMap tm.create_topic tm.create_association(tm.create_topic) engine.tms.getTopicMap(tm_identifier).should_not be_nil engine.delete(tm_identifier) engine.tms.getTopicMap(tm_identifier).should be_nil end end describe "#existing?" do it "should tell if the map is existing" do tm_identifier = "http://www.exampl.org/test/" engine = RTM.connect(:implementation => implementation_for_spec) engine.existing?(tm_identifier).should_not be_true tm = engine.create(tm_identifier) engine.existing?(tm_identifier).should be_true engine.delete(tm_identifier) engine.existing?(tm_identifier).should_not be_true end end end # of describe self end