Sha256: 2af2077c01a51dc8c8c85bd4ee2f39840e1e14132184cfc1b80535f8ef613215

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 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::Sugar::Reifiable
  module Reifier
    describe self do
      before(:each) do
        @tm = get_used_tm_sys_tm
      end
      after(:each) do
        @tm.close
      end

      describe "#reifier!" do
        it "should not return nil if the Reifiable has no reifier" do
          @tm.reifier.should be_nil
          @tm.reifier!.should_not be_nil
        end
        it "should return the reifier if the Reifiable has a reifier" do
          @tm.get("reifier_for_tm").should be_nil
          @tm.reifier = "reifier_for_tm"
          @tm.get("reifier_for_tm").should_not be_nil
          @tm.reifier!.should == @tm.get("reifier_for_tm")
        end
        it "should create a topic as reifier for the Reifiable otherwise" do
          topic1 = @tm.create_topic
          @tm.should have(1).topics
          @tm.reifier.should be_nil
          result = @tm.reifier!
          result.should be_a_kind_of(RTM::Topic)
          @tm.should have(2).topics
          @tm.topics.should include(topic1, result)
          @tm.reifier.should == result
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.3.1 spec/rtm/sugar/reifiable/reifier_spec.rb
rtm-0.3.0 spec/rtm/sugar/reifiable/reifier_spec.rb
rtm-0.2.1 spec/rtm/sugar/reifiable/reifier_spec.rb
rtm-0.2 spec/rtm/sugar/reifiable/reifier_spec.rb