Skip to content
This repository
Browse code

make them all class methods

  • Loading branch information...
commit dd5313270df3d4bb5962233833663226d773ac8f 1 parent 9c22e9a
David Chelimsky dchelimsky authored
8 lib/rspec/core/runner.rb
@@ -11,7 +11,7 @@ def self.installed_at_exit?
11 11 def self.autorun
12 12 return if installed_at_exit? || running_in_drb?
13 13 @installed_at_exit = true
14   - at_exit { new.run(ARGV, $stderr, $stdout) ? exit(0) : exit(1) }
  14 + at_exit { run(ARGV, $stderr, $stdout) ? exit(0) : exit(1) }
15 15 end
16 16
17 17 def self.running_in_drb?
@@ -19,7 +19,7 @@ def self.running_in_drb?
19 19 !!((DRb.current_server.uri) =~ /druby\:\/\/127.0.0.1\:/)
20 20 end
21 21
22   - def run(args, err, out)
  22 + def self.run(args, err, out)
23 23 if args.any? {|a| %w[--drb -X].include? a}
24 24 run_over_drb(args, err, out) || run_in_process(args, err, out)
25 25 else
@@ -27,11 +27,11 @@ def run(args, err, out)
27 27 end
28 28 end
29 29
30   - def run_over_drb(args, err, out)
  30 + def self.run_over_drb(args, err, out)
31 31 DRbCommandLine.new(args).run(err, out)
32 32 end
33 33
34   - def run_in_process(args, err, out)
  34 + def self.run_in_process(args, err, out)
35 35 CommandLine.new(args).run(err, out)
36 36 end
37 37
2  spec/rspec/core/resources/a_spec.rb
... ... @@ -1 +1 @@
1   -# Empty - used by ../options_spec.rb
  1 +# Empty - used by ../options_spec.rb
11 spec/rspec/core/runner_spec.rb
@@ -24,18 +24,13 @@ module RSpec::Core
24 24
25 25 end
26 26
27   - # TODO move collaboration specs into this and cover the other situations
28 27 describe "#run" do
29 28 context "with --drb or -X" do
30 29 before(:each) do
31   - @err, @out = StringIO.new, StringIO.new
32   - @drb_port, @drb_argv = double(Fixnum), double(Array)
  30 + @err = @out = StringIO.new
33 31
34   - @non_drb_args = %w[--color --drb-port 8181]
35   -
36 32 @options = RSpec::Core::ConfigurationOptions.new(%w[--drb --drb-port 8181 --color])
37 33 RSpec::Core::ConfigurationOptions.stub(:new) { @options }
38   -
39 34
40 35 @drb_proxy = double(RSpec::Core::DRbCommandLine, :run => true)
41 36 RSpec::Core::DRbCommandLine.stub(:new => @drb_proxy)
@@ -43,12 +38,12 @@ module RSpec::Core
43 38
44 39 it "builds a DRbCommandLine" do
45 40 RSpec::Core::DRbCommandLine.should_receive(:new)
46   - RSpec::Core::Runner.new.run(%w[ --drb ], @err, @out)
  41 + RSpec::Core::Runner.run(%w[ --drb ], @err, @out)
47 42 end
48 43
49 44 it "runs specs over the proxy" do
50 45 @drb_proxy.should_receive(:run).with(@err, @out)
51   - RSpec::Core::Runner.new.run(%w[ --drb ], @err, @out)
  46 + RSpec::Core::Runner.run(%w[ --drb ], @err, @out)
52 47 end
53 48 end
54 49 end
2  spec/spec_helper.rb
@@ -58,10 +58,8 @@ def in_editor?
58 58 RSpec.instance_variable_set(:@world, @real_world)
59 59 end
60 60 end
61   - puts "PREFORK"
62 61 end
63 62
64 63 Spork.each_run do
65   - puts "EACH RUN"
66 64 end
67 65

0 comments on commit dd53132

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