spork-testunit 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,4 +4,4 @@ This includes a plugin for spork to enable Test::Unit support for spork. It also
4
4
 
5
5
  To use it, install the gem, then fire up spork in your project directory (the file test/test_helper.rb must exist to detect that Test::Unit is being used).
6
6
 
7
- Then, once spork is running, invoke `testdrb test/your_test.rb` to run your tests under Spork.
7
+ Then, once spork is running, invoke @testdrb@ (e.g. @testdrb -Itest test/your_test.rb@) to run your tests under Spork.
@@ -1,11 +1,11 @@
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)
3
5
  begin
4
- # MiniTest is Ruby 1.9.
5
6
  require 'minitest/unit'
6
7
  rescue LoadError
7
- # These fix 1.8.7 test/unit results where a DRbUnknown is returned because the testdrb client doesn't have the classes
8
- # in its local namespace. (See issue #2)
8
+ # MiniTest is Ruby 1.9, and the classes below only exist in the pre 1.9 test/unit
9
9
  require 'test/unit/testresult'
10
10
  require 'test/unit/failure'
11
11
  end
@@ -5,10 +5,11 @@ class Spork::TestFramework::TestUnit < Spork::TestFramework
5
5
  def run_tests(argv, stderr, stdout)
6
6
  if defined? MiniTest
7
7
  # Ruby 1.9
8
+ stdout = Purdytest::IO.new(stdout) if defined? Purdytest # rewrap
8
9
  MiniTest::Unit.output = stdout
9
10
 
10
- # MiniTest's test/unit does not support -I
11
- # Extract it and remove from arguments that are passed to testrb.
11
+ # MiniTest's test/unit does not support -I, -r, or -e
12
+ # Extract them and remove from arguments that are passed to testrb.
12
13
  argv.each_with_index do |arg, idx|
13
14
  if arg =~ /-I(.*)/
14
15
  if $1 == ''
@@ -20,26 +21,64 @@ class Spork::TestFramework::TestUnit < Spork::TestFramework
20
21
  end
21
22
  $LOAD_PATH << include_path
22
23
  argv[idx] = nil
24
+ elsif arg =~ /-r(.*)/
25
+ if $1 == ''
26
+ # File is next argument.
27
+ require_file = argv[idx + 1]
28
+ argv[idx + 1] = nil # Will be squashed when compact called.
29
+ else
30
+ require_file = $1
31
+ end
32
+ require require_file
33
+ argv[idx] = nil
34
+ elsif arg =~ /^-e$/
35
+ eval argv[idx + 1]
36
+ argv[idx] = argv[idx + 1] = nil
23
37
  end
24
38
  end
25
39
  argv.compact!
26
40
 
27
- # copied from ruby-1.9.2-p136/bin/testrb:
28
- require 'test/unit'
29
- Test::Unit.setup_argv(argv) {|files|
30
- if files.empty?
41
+ require 'test/unit'
42
+ if defined? Turn
43
+ # Use turn's wrapper around minitest
44
+ if argv.empty?
31
45
  puts "Usage: testrb [options] tests..."
32
46
  exit 1
33
47
  end
34
- if files.size == 1
35
- $0 = File.basename(files[0])
36
- else
37
- $0 = files.to_s
48
+ runner = Turn::MiniRunner.new
49
+ config = Turn.config do |c|
50
+ c.tests = argv
51
+ c.framework = :minitest
38
52
  end
39
- files
40
- }
53
+ controller = Turn::Controller.new(config)
54
+ controller.start
55
+ elsif Test::Unit.respond_to?(:setup_argv)
56
+ # copied from ruby-1.9.2-p136/bin/testrb:
57
+ Test::Unit.setup_argv(argv) {|files|
58
+ if files.empty?
59
+ puts "Usage: testrb [options] tests..."
60
+ exit 1
61
+ end
62
+ if files.size == 1
63
+ $0 = File.basename(files[0])
64
+ else
65
+ $0 = files.to_s
66
+ end
67
+ files
68
+ }
41
69
 
42
- MiniTest::Unit.new.run(argv)
70
+ MiniTest::Unit.new.run(argv)
71
+ else
72
+ # copied from ruby-head/bin/testrb:
73
+ tests = Test::Unit::AutoRunner.new(true)
74
+ tests.options.banner.sub!(/\[options\]/, '\& tests...')
75
+ unless tests.process_args(argv)
76
+ abort tests.options.banner
77
+ end
78
+ files = tests.to_run
79
+ $0 = files.size == 1 ? File.basename(files[0]) : files.to_s
80
+ tests.run
81
+ end
43
82
  else
44
83
  # Ruby 1.8
45
84
  Object.send(:remove_const, :STDOUT); Object.send(:const_set, :STDOUT, stdout)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork-testunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2009-09-12 00:00:00.000000000Z
12
+ date: 2012-02-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spork
16
- requirement: &70093359486340 !ruby/object:Gem::Requirement
16
+ requirement: &70254965989980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70093359486340
24
+ version_requirements: *70254965989980
25
25
  description: Test Unit runner for spork
26
26
  email:
27
27
  - timcharper+spork@gmail.com
@@ -55,9 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project: spork-testunit
58
- rubygems_version: 1.8.7
58
+ rubygems_version: 1.8.10
59
59
  signing_key:
60
60
  specification_version: 3
61
61
  summary: spork-testunit
62
62
  test_files: []
63
- has_rdoc: