Sha256: 6ad15fc1bc539b06cc2e3a2e2e3dbc42a73e1c1f099b69e2ef20d443fd475a92

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 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::Occurrence

  describe self do
    before(:each) do
      @tm = get_used_tm_sys_tm
    end
    after(:each) do
      @tm.close
    end

    describe "#parent" do
      it "should give back the Topic the Occurrence belongs to" do
        topic = @tm.create_topic_by("House")
        topic.should be_a_kind_of RTM::Topic
        @tm.get("House").should be_a_kind_of RTM::Topic
        testocc = topic.create_occurrence("street number", "1")
        testocc.should be_a_kind_of RTM::Occurrence
        testocc.parent.should == topic
      end
    end

  end # of describe self

  describe self do
    describe "#remove" do
      before(:each) do
        @tm = get_used_tm_sys_tm
        @topic1 = @tm.get!("topic1")
        @topic2 = @tm.get!("topic2")
        @occ = @topic1.create_occurrence("birthyear","2000")
        @topic2.create_occurrence("birthyear","1980")
        @topic1.should have(1).occurrences
        @topic1.occurrences.should include @occ
      end
      after(:each) do
        @tm.close
      end
      it "should remove this name from the container (topic)" do
        @tm.literal_index.getOccurrences("2000").size.should == 1
        @occ.remove
        @tm.literal_index.getOccurrences("2000").size.should == 0
        @tm.literal_index.getOccurrences("1980").size.should == 1
        @topic1.should have(0).occurrences
      end
    end
  end # of describe self

end # of module

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.3.1 spec/rtm/tmapi/core/occurrence_spec.rb
rtm-0.3.0 spec/rtm/tmapi/core/occurrence_spec.rb
rtm-0.2.1 spec/rtm/tmapi/core/occurrence_spec.rb
rtm-0.2 spec/rtm/tmapi/core/occurrence_spec.rb