spec/support/drb_mock_server.rb in riak-client-0.9.0.beta vs spec/support/drb_mock_server.rb in riak-client-0.9.0.beta2
- old
+ new
@@ -5,20 +5,21 @@
extend self
def start_client
# JRuby doesn't support fork
if defined? JRUBY_VERSION
- @server = MockServer.new
+ @server = MockServer.new(2)
at_exit { @server.stop }
else
child_pid = Process.fork do
start_server
end
sleep 1
at_exit { Process.kill("HUP", child_pid); Process.wait2 }
DRb.start_service
@server = DRbObject.new_with_uri(DRBURI)
+ sleep 1
end
true
end
def maybe_start
@@ -27,10 +28,9 @@
def method_missing(meth, *args, &block)
@server.send(meth, *args, &block)
end
- private
def start_server
server = MockServer.new
DRb.start_service(DRBURI, server)
Signal.trap("HUP") { server.stop; exit }
DRb.thread.join