2017-05-07 08:04:49 -04:00
|
|
|
require File.expand_path('../../../spec_helper', __FILE__)
|
|
|
|
require File.expand_path('../fixtures/test_server', __FILE__)
|
|
|
|
require 'drb'
|
|
|
|
|
|
|
|
describe "DRb.start_service" do
|
2017-06-01 13:26:12 -04:00
|
|
|
before :each do
|
|
|
|
@server = DRb.start_service("druby://localhost:0", TestServer.new)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
2017-06-01 13:26:12 -04:00
|
|
|
after :each do
|
|
|
|
DRb.stop_service if @server
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "runs a basic remote call" do
|
2017-06-01 13:26:12 -04:00
|
|
|
DRb.current_server.should == @server
|
|
|
|
obj = DRbObject.new(nil, @server.uri)
|
2017-05-07 08:04:49 -04:00
|
|
|
obj.add(1,2,3).should == 6
|
|
|
|
end
|
|
|
|
|
|
|
|
it "runs a basic remote call passing a block" do
|
2017-06-01 13:26:12 -04:00
|
|
|
DRb.current_server.should == @server
|
|
|
|
obj = DRbObject.new(nil, @server.uri)
|
2017-05-07 08:04:49 -04:00
|
|
|
obj.add_yield(2) do |i|
|
|
|
|
i.should == 2
|
|
|
|
i+1
|
|
|
|
end.should == 4
|
|
|
|
end
|
|
|
|
end
|