Sha256: e20c1d8832f49982d58c1d0f1679e5e2c39f0d53ea730767eef1d1233e33c4d6

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 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 self do
    before(:each) do
      @tm = get_used_tm_sys_tm
      @topic = @tm.get!("ii:http://example.org/topic")
    end
    after(:each) do
      @tm.close
    end
    
    describe "#locators" do
      it "should return all subject locators of this Topic as Strings, even if the Topic was created by given a relative identifier" do
        @topic.locators.size.should == 0
        @topic.add_subject_locator("http://example.org/topic_sl1")
        @topic.should have(1).locators
        @topic.locators.should include "http://example.org/topic_sl1"
        @topic.add_subject_locator("topic_sl2")
        @topic.should have(2).locators
        @topic.locators.should include "http://example.org/topic_sl1", (@tm.base_iri + "topic_sl2")
      end
    end
    
    describe "#locator" do
      it "should give back nil if this Topic has no subject locators" do
        @topic.locator.should be_nil
      end
      it "should retrieve one subject locator of this Topic" do
        @topic.add_subject_locator("http://example.org/topic_sl")
        @topic.locator.should == "http://example.org/topic_sl"
      end
      it "should return one subject locator (the first one, sorted alphabetically) if this Topic has several subject locators" do
        @topic.add_subject_locator("http://example.org/D")
        @topic.add_subject_locator("http://example.org/A")
        @topic.locator.should include "http://example.org/A"
      end
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtm-0.3.1 spec/rtm/navigation/topic/locators_spec.rb
rtm-0.3.0 spec/rtm/navigation/topic/locators_spec.rb
rtm-0.2.1 spec/rtm/navigation/topic/locators_spec.rb
rtm-0.2.0 spec/rtm/navigation/topic/locators_spec.rb
rtm-0.2 spec/rtm/navigation/topic/locators_spec.rb