test-loop 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +1 -1
  2. data/bin/test-loop +8 -10
  3. metadata +3 -3
data/README.md CHANGED
@@ -144,7 +144,7 @@ define the following instance variables:
144
144
 
145
145
  syntax error, unexpected $end, expecting ':'
146
146
  "#{status.success? ? '✔' : '✘'} #{file}"
147
- ^>
147
+ ^
148
148
 
149
149
 
150
150
  License
data/bin/test-loop CHANGED
@@ -57,7 +57,7 @@ begin
57
57
  @test_name_parser ||= lambda do |line|
58
58
  case line
59
59
  when /^\s*def test_(\w+)/ then $1
60
- when /^\s*(test|context|should|describe|it)\b (['"])(.*?)\2/ then $3
60
+ when /^\s*(test|context|should|describe|it)\b (['"])(.*?)\2/ then $3.strip
61
61
  end
62
62
  end
63
63
 
@@ -65,12 +65,12 @@ begin
65
65
  unless test_names.empty?
66
66
  case File.basename(test_file)
67
67
 
68
- when /(\b|_)test(\b|_)/ # Minitest
69
- test_methods = test_names.map {|name| name.strip.gsub(/\W+/, '_') }
70
- ARGV.push '-n', "/#{test_methods.join('|')}/"
68
+ when /(\b|_)test(\b|_)/ # Test::Unit
69
+ test_methods = test_names.map {|name| name.gsub(/\W+/, '_') }
70
+ ARGV.push '--name', "/#{test_methods.join('|')}/"
71
71
 
72
72
  when /(\b|_)spec(\b|_)/ # RSpec
73
- ARGV.push '-e', test_names.map {|name| Regexp.quote(name) }.join('|')
73
+ ARGV.push '--example', test_names.map {|n| Regexp.escape n }.join('|')
74
74
  end
75
75
  end
76
76
  end
@@ -78,11 +78,10 @@ begin
78
78
  @after_all_tests ||= lambda {|success, ran_at, files, statuses|}
79
79
 
80
80
  # absorb test execution overhead into master process
81
- $LOAD_PATH.unshift 'lib' # for non-Rails applications
81
+ $LOAD_PATH.unshift 'lib', 'test', 'spec'
82
82
 
83
83
  notify.call 'Absorbing overhead...'
84
84
  Dir[*@overhead_file_globs].each do |file|
85
- $LOAD_PATH.insert 1, File.dirname(file)
86
85
  require File.basename(file, File.extname(file))
87
86
  end
88
87
 
@@ -108,8 +107,6 @@ begin
108
107
  last_ran_at = Time.now
109
108
 
110
109
  test_files.each do |test_file|
111
- notify.call test_file
112
-
113
110
  # cache the contents of the test file for diffing below
114
111
  new_lines = File.readlines(test_file)
115
112
  old_lines = @test_file_cache[test_file] || new_lines
@@ -148,6 +145,7 @@ begin
148
145
  success &&= test_passed = status.success?
149
146
  notify.call "#{test_passed ? 'PASS' : 'FAIL'} #{file}"
150
147
  end
148
+ notify.call "Ran in #{Time.now - last_ran_at} seconds"
151
149
 
152
150
  @after_all_tests.call(success, last_ran_at, test_files, statuses)
153
151
  end
@@ -165,6 +163,6 @@ rescue Interrupt
165
163
  # user wants to quit the loop
166
164
 
167
165
  rescue Exception => error
168
- puts error.inspect, error.backtrace
166
+ STDERR.puts error.inspect, error.backtrace
169
167
  sleep 1 and exec(*process_invocation_vector)
170
168
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 4
7
7
  - 0
8
- - 0
9
- version: 4.0.0
8
+ - 1
9
+ version: 4.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Suraj N. Kurapati
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-13 00:00:00 -08:00
17
+ date: 2011-01-14 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency