summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-01 17:26:12 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-01 17:26:12 +0000
commit321300d4e078bf723fcd7388a701a9805ce8af9d (patch)
tree300c51c6dd080209f3120be90c714fc7ccb2b66a /spec
parent96ab53602aea1098244328750cd389ae1d2ad109 (diff)
Fix DRb.start_service to use any available port
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r--spec/rubyspec/library/drb/start_service_spec.rb25
1 files changed, 8 insertions, 17 deletions
diff --git a/spec/rubyspec/library/drb/start_service_spec.rb b/spec/rubyspec/library/drb/start_service_spec.rb
index e3ef48b3e3..f64021f0bd 100644
--- a/spec/rubyspec/library/drb/start_service_spec.rb
+++ b/spec/rubyspec/library/drb/start_service_spec.rb
@@ -3,35 +3,26 @@ require File.expand_path('../fixtures/test_server', __FILE__)
require 'drb'
describe "DRb.start_service" do
- before :all do
- @port = 9001 + (Process.pid & 7 )
+ before :each do
+ @server = DRb.start_service("druby://localhost:0", TestServer.new)
end
- before :each do
- @url = "druby://localhost:#{@port}"
- @port += 1
+ after :each do
+ DRb.stop_service if @server
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)
+ DRb.current_server.should == @server
+ obj = DRbObject.new(nil, @server.uri)
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)
+ DRb.current_server.should == @server
+ obj = DRbObject.new(nil, @server.uri)
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