Sha256: 6b9eadc6cf645d46ae944e62376c9bffd44cfa5981758a2f9f938be850f57502

Contents?: true

Size: 1.59 KB

Versions: 1

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::Variant

  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 Name to which the Variant belongs" do
        topic = @tm.create_topic_by("sub:ident")
        topic.should be_a_kind_of RTM::Topic
        @tm.get("sub:ident").should be_a_kind_of RTM::Topic

        scope = @tm.create_topic_by("englisch")
        scope.should be_a_kind_of RTM::Topic
        @tm.get("englisch").should be_a_kind_of RTM::Topic

        testname = topic.create_name("Deutschland")
        testname.should be_a_kind_of RTM::Name
        testvariant = testname.create_variant("Germany", [scope])
        testvariant.should be_a_kind_of RTM::Variant
        testvariant.parent.should == testname
      end
    end

    describe "#remove" do
      before(:each) do
        @topic1 = @tm.get!("topic1")
        @name1 = @topic1.create_name("firstname","Hans")
        @name2 = @topic1.create_name("lastname","Meier")
        @variant1 = @name1.create_variant("Hansi",["alias"])
        @variant2 = @name1.create_variant("Bubi",["endearment"])
      end
      it "should remove this Variant from the container (Name)" do
        @name1.should have(2).children
        @variant1.remove
        @name1.should have(1).children
        @variant2.remove
        @name1.should have(0).children
      end
    end
    
  end # of describe self
end # of module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.2.0 spec/rtm/tmapi/core/variant_spec.rb