test-loop 5.0.0 → 5.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 +5 -5
  2. data/bin/test-loop +9 -5
  3. metadata +3 -3
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  test-loop - Continuous testing for Ruby with fork/eval
2
2
  ======================================================
3
3
 
4
- test-loop is a fast continuous testing tool for Ruby that continuously detects
5
- and tests changes in your Ruby application in an efficient manner, whereby it:
4
+ test-loop is a fast continuous testing tool for Ruby that automatically
5
+ detects and tests changes in your application in an efficient manner:
6
6
 
7
7
  1. Absorbs the test execution overhead into the main Ruby process.
8
- 2. Forks to run (eval) your test files directly, without overhead.
8
+ 2. Forks to run your test files without overhead and in parallel.
9
9
  3. Avoids running unchanged test blocks inside changed test files.
10
10
 
11
11
  It relies on file modification times to determine what parts of your Ruby
@@ -93,7 +93,7 @@ statement yields a hash that may optionally contain the following entries:
93
93
 
94
94
  For example, if test files had the same names as their source files but the
95
95
  letters were in reverse order, then you would add the following hash entry
96
- to your `.test-loop` file:
96
+ to your configuration file:
97
97
 
98
98
  :test_file_matchers => {
99
99
  '{lib,app}/**/*.rb' => lambda do |path|
@@ -123,7 +123,7 @@ statement yields a hash that may optionally contain the following entries:
123
123
 
124
124
  For example, to display a summary of the test execution results as an OSD
125
125
  notification via libnotify, add the following hash entry to your
126
- `.test-loop` file:
126
+ configuration file:
127
127
 
128
128
  :after_all_tests => lambda do |success, ran_at, files, statuses|
129
129
  icon = success ? 'apple-green' : 'apple-red'
@@ -56,20 +56,24 @@ begin
56
56
  config[:test_name_parser] ||= lambda do |line|
57
57
  case line
58
58
  when /^\s*def test_(\w+)/ then $1
59
- when /^\s*(test|context|should|describe|it)\b (['"])(.*?)\2/ then $3.strip
59
+ when /^\s*(test|context|should|describe|it)\b (['"])(.*?)\2/ then $3
60
60
  end
61
61
  end
62
62
 
63
63
  config[:before_each_test] ||= lambda do |test_file, test_names|
64
64
  unless test_names.empty?
65
+ test_name_pattern = test_names.map do |name|
66
+ # sanitize string interpolation and non-method-name characters
67
+ name.strip.gsub(/\#\{.*?\}/, ' ').gsub(/\W+/, '.+')
68
+ end.join('|')
69
+
65
70
  case File.basename(test_file)
66
71
 
67
72
  when /(\b|_)test(\b|_)/ # Test::Unit
68
- test_methods = test_names.map {|name| name.gsub(/\W+/, '_') }
69
- ARGV.push '--name', "/#{test_methods.join('|')}/"
73
+ ARGV.push '--name', "/#{test_name_pattern}/"
70
74
 
71
75
  when /(\b|_)spec(\b|_)/ # RSpec
72
- ARGV.push '--example', test_names.map {|n| Regexp.escape n }.join('|')
76
+ ARGV.push '--example', test_name_pattern
73
77
  end
74
78
  end
75
79
  end
@@ -138,7 +142,7 @@ begin
138
142
  statuses = Process.waitall.map {|pid, status| status }
139
143
 
140
144
  success = true
141
- test_files.zip(statuses).map do |file, status|
145
+ test_files.zip(statuses).each do |file, status|
142
146
  success &&= test_passed = status.success?
143
147
  notify.call "#{test_passed ? 'PASS' : 'FAIL'} #{file}"
144
148
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 5
7
7
  - 0
8
- - 0
9
- version: 5.0.0
8
+ - 1
9
+ version: 5.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-17 00:00:00 -08:00
17
+ date: 2011-01-18 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency