Sha256: 641f1e8fc0606c1b303ec6a9ff086de655a8807e135e614354ec5d80f1ff0527

Contents?: true

Size: 1.63 KB

Versions: 5

Compression:

Stored size: 1.63 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 "#indicators" do
      it "should return all indicators of this Topic as Strings, even if the Topic was created by given a relative identifier" do
        @topic.indicators.size.should == 0
        @topic.add_subject_identifier("http://example.org/topic_si1")
        @topic.should have(1).indicators
        @topic.indicators.should include "http://example.org/topic_si1"
        @topic.add_subject_identifier("topic_si2")
        @topic.should have(2).indicators
        @topic.indicators.should include "http://example.org/topic_si1", (@tm.base_iri + "topic_si2")
      end
    end
    
    describe "#indicator" do
      it "should give back nil if this Topic has no indicators" do
        @topic.indicator.should be_nil
      end
      it "should retrieve one indicator of this Topic" do
        @topic.add_subject_identifier("http://example.org/topic_si")
        @topic.indicator.should == "http://example.org/topic_si"
      end
      it "should return one indicator (the first one, sorted alphabetically) if this Topic has several subject identifiers" do
        @topic.add_subject_identifier("http://example.org/D")
        @topic.add_subject_identifier("http://example.org/A")
        @topic.indicator.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/indicators_spec.rb
rtm-0.3.0 spec/rtm/navigation/topic/indicators_spec.rb
rtm-0.2.1 spec/rtm/navigation/topic/indicators_spec.rb
rtm-0.2.0 spec/rtm/navigation/topic/indicators_spec.rb
rtm-0.2 spec/rtm/navigation/topic/indicators_spec.rb