# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../../spec_helper' module RTM::IO::ToHash describe self do before(:each) do @tm = get_used_tm_sys_tm @tm.reifier! @topic = @tm.get!("a:b") @name = @topic.create_name("name type", "name value", ["theme1", "theme2"]) @name.reifier! @var = @name.create_variant(1234, RTM::PSI[:String], ["theme5"]) @var.reifier! @occ = @topic.create_occurrence("occ type", "occ value", :datatype => RTM::PSI[:IRI], :scope => ["theme3", "theme4"]) @occ.reifier! @assoc = @tm.create_association("assoc type", ["theme6", "theme7"]) @assoc.reifier! @role = @assoc.create_role("role type", "role player") @role.reifier! @locator = @tm.create_locator("http://www.example.org/test this locator") end after(:each) do @output.should be_a_kind_of Hash @tm.close end describe "#to_hash" do describe "for TopicMap" do before(:each) do @tm.should be_a_kind_of RTM::TopicMap end it "should give back a Hash" do @output = @tm.to_hash end end describe "for Topic" do before(:each) do @topic.should be_a_kind_of RTM::Topic end it "should give back a Hash" do @output = @topic.to_hash end end describe "for Association" do before(:each) do @assoc.should be_a_kind_of RTM::Association end it "should give back a Hash" do @output = @assoc.to_hash end end describe "for Role" do before(:each) do @role.should be_a_kind_of RTM::Role end it "should give back a Hash" do @output = @role.to_hash end end describe "for Name" do before(:each) do @name.should be_a_kind_of RTM::Name end it "should give back a Hash" do @output = @name.to_hash end end describe "for Occurrence" do before(:each) do @occ.should be_a_kind_of RTM::Occurrence end it "should give back a Hash" do @output = @occ.to_hash end end describe "for Variant" do before(:each) do @var.should be_a_kind_of RTM::Variant end it "should give back a Hash" do @output = @var.to_hash end end end end end