spork-testunit 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/testdrb CHANGED
@@ -1,5 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # These fix 1.8.7 test/unit results where a DRbUnknown is returned because the testdrb client doesn't have the classes
4
+ # in its local namespace. (See issue #2)
5
+ unless RUBY_VERSION =~ /^1\.9/
6
+ # MiniTest is Ruby 1.9, and the classes below only exist in the pre 1.9 test/unit
7
+ require 'test/unit/testresult'
8
+ require 'test/unit/failure'
9
+ end
3
10
 
4
11
  require 'drb'
5
12
  DRb.start_service("druby://127.0.0.1:0") # this allows Ruby to do some magical stuff so you can pass an output stream over DRb.
@@ -3,11 +3,42 @@ class Spork::TestFramework::TestUnit < Spork::TestFramework
3
3
  HELPER_FILE = File.join(Dir.pwd, "test/test_helper.rb")
4
4
 
5
5
  def run_tests(argv, stderr, stdout)
6
- Object.send(:remove_const, :STDOUT); Object.send(:const_set, :STDOUT, stdout)
7
- require 'test/unit/autorunner'
8
- r = Test::Unit::AutoRunner.new(true)
9
- exit(false) unless r.process_args(argv)
10
- r.run
6
+ if defined? MiniTest
7
+ # Ruby 1.9
8
+ MiniTest::Unit.output = stdout
9
+
10
+ # MiniTest's test/unit does not support -I
11
+ argv.reject!{|item|
12
+ if item =~ /-I(.*)/
13
+ $LOAD_PATH << $1
14
+ true
15
+ end
16
+ }
17
+
18
+ # copied from ruby-1.9.2-p136/bin/testrb:
19
+ require 'test/unit'
20
+ Test::Unit.setup_argv(argv) {|files|
21
+ if files.empty?
22
+ puts "Usage: testrb [options] tests..."
23
+ exit 1
24
+ end
25
+ if files.size == 1
26
+ $0 = File.basename(files[0])
27
+ else
28
+ $0 = files.to_s
29
+ end
30
+ files
31
+ }
32
+
33
+ MiniTest::Unit.new.run(argv)
34
+ else
35
+ # Ruby 1.8
36
+ Object.send(:remove_const, :STDOUT); Object.send(:const_set, :STDOUT, stdout)
37
+ require 'test/unit/autorunner'
38
+ r = Test::Unit::AutoRunner.new(true)
39
+ exit(false) unless r.process_args(argv)
40
+ r.run
41
+ end
11
42
  rescue => e
12
43
  puts "-"*30
13
44
  puts "Error executing #{argv.join(' ')}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork-testunit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Harper
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements: []
78
78
 
79
79
  rubyforge_project: spork-testunit
80
- rubygems_version: 1.3.7
80
+ rubygems_version: 1.5.0
81
81
  signing_key:
82
82
  specification_version: 3
83
83
  summary: spork-testunit