Skip to content
This repository
Browse code

Merge pull request #629 from rspec/delay-drb-loading

Delay the loading of DRB.
  • Loading branch information...
commit 9a790826d538322c370bd543b11c43deb98b4bd6 2 parents d89c87b + 3646611
Myron Marston authored
2  lib/rspec/core.rb
@@ -31,10 +31,8 @@ def require_rspec(path)
31 31
 require_rspec 'core/configuration'
32 32
 require_rspec 'core/project_initializer'
33 33
 require_rspec 'core/option_parser'
34  
-require_rspec 'core/drb_options'
35 34
 require_rspec 'core/configuration_options'
36 35
 require_rspec 'core/command_line'
37  
-require_rspec 'core/drb_command_line'
38 36
 require_rspec 'core/runner'
39 37
 require_rspec 'core/example'
40 38
 require_rspec 'core/shared_example_group'
3  lib/rspec/core/drb_command_line.rb
... ...
@@ -1,3 +1,6 @@
  1
+require 'drb/drb'
  2
+require 'rspec/core/drb_options'
  3
+
1 4
 module RSpec
2 5
   module Core
3 6
     class DRbCommandLine
4  lib/rspec/core/runner.rb
... ...
@@ -1,5 +1,3 @@
1  
-require 'drb/drb'
2  
-
3 1
 module RSpec
4 2
   module Core
5 3
     class Runner
@@ -25,6 +23,7 @@ def self.installed_at_exit?
25 23
       end
26 24
 
27 25
       def self.running_in_drb?
  26
+        defined?(DRb) &&
28 27
         (DRb.current_server rescue false) &&
29 28
          DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
30 29
       end
@@ -59,6 +58,7 @@ def self.run(args, err=$stderr, out=$stdout)
59 58
         options.parse_options
60 59
 
61 60
         if options.options[:drb]
  61
+          require 'rspec/core/drb_command_line'
62 62
           begin
63 63
             DRbCommandLine.new(options).run(err, out)
64 64
           rescue DRb::DRbConnError
1  spec/rspec/core/drb_command_line_spec.rb
... ...
@@ -1,4 +1,5 @@
1 1
 require "spec_helper"
  2
+require 'rspec/core/drb_command_line'
2 3
 
3 4
 describe "::DRbCommandLine", :type => :drb, :unless => RUBY_PLATFORM == 'java' do
4 5
   let(:config) { RSpec::Core::Configuration.new }
1  spec/rspec/core/drb_options_spec.rb
... ...
@@ -1,4 +1,5 @@
1 1
 require "spec_helper"
  2
+require 'rspec/core/drb_options'
2 3
 
3 4
 describe RSpec::Core::DrbOptions, :fakefs do
4 5
   include ConfigOptionsHelper

0 notes on commit 9a79082

Please sign in to comment.
Something went wrong with that request. Please try again.