mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00

* For easier modifications of ruby/spec by MRI developers. * .gitignore: track changes under spec. * spec/mspec, spec/rubyspec: add in-tree mspec and ruby/spec. These files can therefore be updated like any other file in MRI. Instructions are provided in spec/README. [Feature #13156] [ruby-core:79246] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
37 lines
1.1 KiB
Ruby
37 lines
1.1 KiB
Ruby
require File.expand_path('../../../spec_helper', __FILE__)
|
|
require File.expand_path('../fixtures/test_server', __FILE__)
|
|
require 'drb'
|
|
|
|
describe "DRb.start_service" do
|
|
before :all do
|
|
@port = 9001 + (Process.pid & 7 )
|
|
end
|
|
|
|
before :each do
|
|
@url = "druby://localhost:#{@port}"
|
|
@port += 1
|
|
end
|
|
|
|
it "runs a basic remote call" do
|
|
lambda { DRb.current_server }.should raise_error(DRb::DRbServerNotFound)
|
|
server = DRb.start_service(@url, TestServer.new)
|
|
DRb.current_server.should == server
|
|
obj = DRbObject.new(nil, @url)
|
|
obj.add(1,2,3).should == 6
|
|
DRb.stop_service
|
|
lambda { DRb.current_server }.should raise_error(DRb::DRbServerNotFound)
|
|
end
|
|
|
|
it "runs a basic remote call passing a block" do
|
|
lambda { DRb.current_server }.should raise_error(DRb::DRbServerNotFound)
|
|
server = DRb.start_service(@url, TestServer.new)
|
|
DRb.current_server.should == server
|
|
obj = DRbObject.new(nil, @url)
|
|
obj.add_yield(2) do |i|
|
|
i.should == 2
|
|
i+1
|
|
end.should == 4
|
|
DRb.stop_service
|
|
lambda { DRb.current_server }.should raise_error(DRb::DRbServerNotFound)
|
|
end
|
|
end
|