From: Massimiliano Mirra Date: 2001-11-25T13:16:04+09:00 Subject: [ruby-talk:26414] DRb and failing test, please give some insight... I am familiarizing with DRb. I managed to put to work a tiny c/s structure a la ICQ, with clients logging into a server and then messaging each other. The messaging part works fine (I stripped it in the listing below) but the online query, that looks very simple and linear to me, causes the test to fail. At 5 am I'm probably very blind to the obvious and can't see why. Anybody on the other side of the planet and a bit more into the day is willing to, er, shed some light? Massimiliano #!/usr/bin/env ruby require 'drb' class Client include DRbUndumped attr_reader :name def initialize(name, server_uri) DRb.start_service @name = name @server = DRbObject.new(nil, server_uri) end def login @server.register(self) end def logout @server.unregister(self) end def online? @server.online?(self) end end class Server attr_reader :users def initialize @users = [] end def register(user) @users.push user unless @users.include?(user) end def unregister(user) @users.delete(user) end def online?(user) @users.include?(user) end end require 'Lapidary/TestCase' class TestConnection < Lapidary::TestCase def initialize(*args) super DRb.start_service(nil, Server.new) @server_uri = DRb.uri end def testOnline client = Client.new("jim", @server_uri) assert_equal(false, client.online?) client.login assert_equal(true, client.online?) end end if $0 == __FILE__ require 'Lapidary/UI/Console/TestRunner' Lapidary::UI::Console::TestRunner.run(TestConnection) end