Sha256: 4900508f4c3c147d9a89ebe3ea14761ed3e8e76a95080ab8dee0080bd11a366b

Contents?: true

Size: 1.59 KB

Versions: 5

Compression:

Stored size: 1.59 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!("http://example.org/topic")
    end
    after(:each) do
      @tm.close
    end
    
    describe "#items" do
      it "should return all item identifier of this Topic as Strings, even if the Topic was created by given a relative identifier" do
        @topic.items.size.should == 0
        @topic.add_item_identifier("http://example.org/topic_ii1")
        @topic.should have(1).items
        @topic.items.should include "http://example.org/topic_ii1"
        @topic.add_item_identifier("topic_ii2")
        @topic.should have(2).items
        @topic.items.should include "http://example.org/topic_ii1", (@tm.base_iri + "topic_ii2")
      end
    end
    
    describe "#item" do
      it "should give back nil if this Topic has no item identifiers" do
        @topic.item.should be_nil
      end
      it "should retrieve one item identifier of this Topic" do
        @topic.add_item_identifier("http://example.org/topic_ii")
        @topic.item.should == "http://example.org/topic_ii"
      end
      it "should return one item identifier (the first one, sorted alphabetically) if this Topic has several item identifiers" do
        @topic.add_item_identifier("http://example.org/D")
        @topic.add_item_identifier("http://example.org/A")
        @topic.item.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/items_spec.rb
rtm-0.3.0 spec/rtm/navigation/topic/items_spec.rb
rtm-0.2.1 spec/rtm/navigation/topic/items_spec.rb
rtm-0.2.0 spec/rtm/navigation/topic/items_spec.rb
rtm-0.2 spec/rtm/navigation/topic/items_spec.rb