require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require File.dirname(__FILE__) + '/../lib/drbproxy' describe DRbProxy do before(:all) do @server_pid = fork do class TestProxy attr_reader :param CONSTANT = 'constant' def initialize(param) @param = param end def instance_method 'instance method' end def self.klass_method 'klass method' end class Inner CONSTANT = 'inner constant' def instance_method 'inner instance method' end def self.klass_method 'inner klass method' end end end require File.dirname(__FILE__) + '/../lib/drbproxy/server' end server = DRbObject.new_with_uri(DRbProxy::DRB_URI) sleep(0.1) until server_ready?(server) end after(:all) do Process.kill(Signal.list['TERM'], @server_pid) end def server_ready?(server) begin server.ready? rescue Exception#DRb::DRbUnknownError false end end it "should do something" do class TestProxy < DRbProxy::DRbProxyClass end test = TestProxy.new('test') test.instance_method.should == 'instance method' test.param.should == 'test' TestProxy.klass_method == 'klass method' TestProxy::CONSTANT.should == 'constant' inner = TestProxy::Inner.new inner.instance_method.should == 'inner instance method' TestProxy::Inner.klass_method.should == 'inner klass method' TestProxy::Inner::CONSTANT.should == 'inner constant' end end