ruby-changes:46880
From: eregon <ko1@a...>
Date: Fri, 2 Jun 2017 02:26:16 +0900 (JST)
Subject: [ruby-changes:46880] eregon:r58995 (trunk): Fix DRb.start_service to use any available port
eregon 2017-06-02 02:26:12 +0900 (Fri, 02 Jun 2017) New Revision: 58995 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58995 Log: Fix DRb.start_service to use any available port Modified files: trunk/spec/rubyspec/library/drb/start_service_spec.rb Index: spec/rubyspec/library/drb/start_service_spec.rb =================================================================== --- spec/rubyspec/library/drb/start_service_spec.rb (revision 58994) +++ spec/rubyspec/library/drb/start_service_spec.rb (revision 58995) @@ -3,35 +3,26 @@ require File.expand_path('../fixtures/te https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/library/drb/start_service_spec.rb#L3 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/