Sha256: cbeeeac102c44808b74216d3267ab3f899be8784f92e90510b5dc4e5b8e54d16
Contents?: true
Size: 1.84 KB
Versions: 4
Compression:
Stored size: 1.84 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../../../spec_helper' module Sugar module Association module HashAccess describe "#[]" do before(:each) do @tm = get_used_tm_sys_tm @assoc = @tm.create_association("assoc_type") @assoc2 = @tm.create_association("assoc_type2") @role1 = @assoc.create_role("role_type1", "player1") @role2 = @assoc.create_role("role_type2","player2") @role3 = @assoc2.create_role("role_type3","player3") @role4 = @assoc.create_role("role_type2","player4") end after(:each) do @tm.close end it "should give back Roles which have the specified Role type" do @assoc["role_type1"].size.should == 1 @assoc["role_type1"].should include(@role1) @assoc["role_type2"].size.should == 2 @assoc["role_type2"].should include(@role2) @assoc["role_type2"].should include(@role4) end it "should give back an empty Array if the type does not exist" do @assoc["wrong_type"].should == [] end it "should give back all roles of the association if no type is given or type==:any" do @assoc[].size.should == 3 @assoc[:any].size.should == 3 @assoc[].should include(@role1) @assoc[].should include(@role2) @assoc[].should include(@role4) @assoc[:any].should include(@role1) @assoc[:any].should include(@role2) @assoc[:any].should include(@role4) end end describe "#[]=" do before(:each) do @tm = get_used_tm_sys_tm end after(:each) do @tm.close end it "should test []=" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems