guard-test 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +20 -12
- data/README.md +23 -45
- data/lib/guard/test/guard_test_runner.rb +48 -0
- data/lib/guard/test/{runners/default_test_unit_runner.rbc → guard_test_runner.rbc} +596 -568
- data/lib/guard/test/inspector.rbc +473 -161
- data/lib/guard/test/notifier.rb +30 -7
- data/lib/guard/test/notifier.rbc +680 -60
- data/lib/guard/test/runner.rb +43 -28
- data/lib/guard/test/runner.rbc +412 -703
- data/lib/guard/test/templates/Guardfile +1 -1
- data/lib/guard/test/version.rb +1 -1
- data/lib/guard/test/version.rbc +61 -11
- data/lib/guard/test.rb +1 -1
- data/lib/guard/test.rbc +245 -142
- metadata +14 -22
- data/lib/guard/test/result_helpers.rb +0 -28
- data/lib/guard/test/result_helpers.rbc +0 -798
- data/lib/guard/test/runners/default_guard_test_runner.rb +0 -64
- data/lib/guard/test/runners/default_guard_test_runner.rbc +0 -1442
- data/lib/guard/test/runners/fastfail_guard_test_runner.rb +0 -29
- data/lib/guard/test/runners/fastfail_guard_test_runner.rbc +0 -596
- data/lib/guard/test/runners/fastfail_test_unit_runner.rbc +0 -562
- data/lib/guard/test/ui.rb +0 -38
- data/lib/guard/test/ui.rbc +0 -1053
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,26 @@
|
|
1
|
+
## 0.4.0 - September 29, 2011 - ([@rymai][])
|
2
|
+
|
3
|
+
### Regression:
|
4
|
+
|
5
|
+
- Removed support of [turn](https://github.com/guard/guard-spork) gem since "Turn is no longer compatible with TestUnit 2.0+. TestUnit and MiniTest are deverging and after some consideration it was decided that Turn's goal is to support Ruby's native test framework, whatever it may be." quoted from Turn's [release.txt](https://github.com/TwP/turn/blob/master/Release.txt).
|
6
|
+
|
7
|
+
### New feature:
|
8
|
+
|
9
|
+
- New `:drb` option enabling the use of [`spork-testunit`](https://github.com/timcharper/spork-testunit) gem (be sure to use [guard-spork](https://github.com/guard/guard-spork) as well).
|
10
|
+
|
1
11
|
## 0.3.1 - September 11, 2011
|
2
12
|
|
3
|
-
### New
|
13
|
+
### New feature:
|
4
14
|
|
5
15
|
- Pull request [#13](https://github.com/guard/guard-test/pull/13): New `test_paths` option to look for test files under other paths than `test`. ([@Ask11][])
|
6
16
|
|
7
|
-
###
|
17
|
+
### Improvement:
|
8
18
|
|
9
19
|
- Pull request [#15](https://github.com/guard/guard-test/pull/15): Simplify some checks. ([@dasch][])
|
10
20
|
|
11
21
|
## 0.3.0 - June 14, 2011
|
12
22
|
|
13
|
-
###
|
23
|
+
### Improvement:
|
14
24
|
|
15
25
|
- Internal cleaning. ([@rymai][])
|
16
26
|
|
@@ -22,7 +32,7 @@
|
|
22
32
|
- Fixed the `fastfail` runner that was displaying a green dot even for a failing test. ([@rymai][])
|
23
33
|
- Removed the `:notification` option. Use the new Guard method instead. ([@rymai][])
|
24
34
|
|
25
|
-
### New
|
35
|
+
### New feature:
|
26
36
|
|
27
37
|
- Turn seems to work fine now... ([@rymai][])
|
28
38
|
|
@@ -32,13 +42,13 @@
|
|
32
42
|
|
33
43
|
## 0.3.0.rc4 - June 3, 2011 - ([@rymai][])
|
34
44
|
|
35
|
-
### Bugs
|
45
|
+
### Bugs fix:
|
36
46
|
|
37
47
|
- Add a require that was making the guard be fired by Guard! :'(
|
38
48
|
|
39
49
|
## 0.3.0.rc3 - June 3, 2011 - ([@rymai][])
|
40
50
|
|
41
|
-
### Bugs
|
51
|
+
### Bugs fix:
|
42
52
|
|
43
53
|
- Actually make the tests run.
|
44
54
|
|
@@ -56,26 +66,24 @@
|
|
56
66
|
- New `:all_after_pass` option (true by default) to run all tests after changed tests pass.
|
57
67
|
- New `:keep_failed` option (true by default) to keep failed tests until them pass.
|
58
68
|
|
59
|
-
###
|
69
|
+
### Improvements:
|
60
70
|
|
61
71
|
- Added compatibility with 1.8.6, 1.8.7, 1.9.2, REE, Rubinius and JRuby.
|
62
72
|
- Internal changes inspired by [guard-minitest](https://github.com/guard/guard-minitest).
|
63
73
|
|
64
74
|
## 0.1.6 - January 24, 2011
|
65
75
|
|
66
|
-
### Bugs
|
76
|
+
### Bugs fix:
|
67
77
|
|
68
78
|
- Issue [#2](https://github.com/guard/guard-test/issues/2): Fixed a bug introduced in 0.1.5 where test/ was not added to the $LOAD_PATH. (reported by [@jgrau][], fixed by [@rymai][])
|
69
79
|
|
70
|
-
## 0.1.5 - January 21, 2011
|
71
|
-
|
72
|
-
### Changes:
|
80
|
+
## 0.1.5 - January 21, 2011 - ([@rymai][])
|
73
81
|
|
74
82
|
- Updated gem dependencies
|
75
83
|
|
76
84
|
## 0.1.4 - December 15, 2010
|
77
85
|
|
78
|
-
### Bugs
|
86
|
+
### Bugs fix:
|
79
87
|
|
80
88
|
- Pull request [#1](https://github.com/guard/guard-test/pull/1): Include errors count to determine the "flag" to display in notification. ([@gregorymostizky][])
|
81
89
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Guard::Test [![Build Status](
|
1
|
+
# Guard::Test [![Build Status](https://secure.travis-ci.org/guard/guard-test.png)](http://travis-ci.org/guard/guard-test)
|
2
2
|
|
3
3
|
Test::Unit guard allows to automatically & intelligently launch tests when files are modified or created.
|
4
4
|
|
@@ -6,7 +6,7 @@ If you have any questions about Guard or Guard::Test, please join us on our [Goo
|
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
9
|
-
- Compatible with
|
9
|
+
- Compatible with test-unit 2.
|
10
10
|
- Tested on Ruby 1.8.7, 1.9.2, REE, Rubinius and JRuby.
|
11
11
|
|
12
12
|
## Install
|
@@ -39,67 +39,45 @@ $ guard init test
|
|
39
39
|
|
40
40
|
## Usage
|
41
41
|
|
42
|
-
Please read [Guard usage doc](https://github.com/guard/guard#readme).
|
42
|
+
Please read the [Guard usage doc](https://github.com/guard/guard#readme).
|
43
43
|
|
44
44
|
## Guardfile
|
45
45
|
|
46
46
|
Guard::Test can be adapted to any kind of projects.
|
47
47
|
|
48
|
-
|
48
|
+
See the [template Guardfile](https://github.com/guard/guard-test/blob/master/lib/guard/test/templates/Guardfile) for some examples.
|
49
49
|
|
50
|
-
|
51
|
-
guard 'test' do
|
52
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
53
|
-
watch(%r{^test/.+_test\.rb$})
|
54
|
-
watch('test/test_helper.rb') { "test" }
|
55
|
-
end
|
56
|
-
```
|
50
|
+
Please read the [Guard documentation](https://github.com/guard/guard#readme) for more info about the Guardfile DSL.
|
57
51
|
|
58
|
-
|
52
|
+
## Options
|
59
53
|
|
60
|
-
|
61
|
-
guard 'test' do
|
62
|
-
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
63
|
-
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
64
|
-
watch(%r{^app/views/.+\.rb$}) { "test/integration" }
|
65
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
66
|
-
watch(%r{^test/.+_test.rb$})
|
67
|
-
watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
|
68
|
-
watch('test/test_helper.rb') { "test" }
|
69
|
-
end
|
70
|
-
```
|
54
|
+
**Deprecation notice:** The `:runner` option is deprecated. If you had set it to "fastfail", it is now the default in test-unit 2, but if you want the opposite, you can pass the `:cli => '--no-show-detail-immediately'` option instead.
|
71
55
|
|
72
|
-
|
56
|
+
### Available options
|
73
57
|
|
74
|
-
|
58
|
+
* `bundler` (`Boolean`) - Whether or not to use `bundle exec` to run tests. Default to `true` if a you have a Gemfile in the current directory.
|
59
|
+
* `rvm` (`Array<String>`) - Directly run your specs against multiple Rubies. Default to `nil`.
|
60
|
+
* `drb` (`Boolean`) - Run your tests with [`spork-testunit`](https://github.com/timcharper/spork-testunit). Default to `false`.
|
61
|
+
* `cli` (`String`) - Pass arbitrary CLI arguments to the command that runs the tests. Default to `nil`.
|
62
|
+
* `all_on_start` (`Boolean`) - Run all tests on Guard startup. Default to `true`.
|
63
|
+
* `all_after_pass` (`Boolean`) - Run all tests after the current run tests pass. Default to `true`.
|
64
|
+
* `keep_failed` (`Boolean`) - Re-run failing tests until they pass. Default to `true`.
|
65
|
+
* `test_paths` (`Array<String>`) - Array of paths that where are located the test files. Default to `['test']`.
|
75
66
|
|
76
|
-
|
67
|
+
#### `drb` option
|
77
68
|
|
78
|
-
|
79
|
-
|
80
|
-
|
69
|
+
When true, notifications are disabled. This might be fixed in future releases.
|
70
|
+
|
71
|
+
#### `test_paths` option
|
81
72
|
|
82
73
|
By default, guard-test will only look for test files within `test/` in your project root. You can add any paths using the `:test_paths` option:
|
83
74
|
|
84
75
|
```ruby
|
85
|
-
guard
|
76
|
+
guard :test, :test_paths => ['test', 'vendor/plugins/recaptcha/test', 'any/path/test'] do
|
86
77
|
# ...
|
87
78
|
end
|
88
79
|
```
|
89
80
|
|
90
|
-
Available options:
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
:rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple Rubies, default: nil
|
94
|
-
:bundler => false # don't use "bundle exec" to run the test command, default: true if a you have a Gemfile
|
95
|
-
:runner => 'fastfail' # default: 'default'
|
96
|
-
:cli => "-v" # pass arbitrary CLI arguments to the Ruby command that runs the tests, default: nil
|
97
|
-
:all_on_start => false # don't run all the tests at startup, default: true
|
98
|
-
:all_after_pass => false # don't run all tests after changed tests pass, default: true
|
99
|
-
:keep_failed => false # keep failed tests until them pass, default: true
|
100
|
-
:test_paths => ['spec'] # specify an array of paths that contain test files
|
101
|
-
```
|
102
|
-
|
103
81
|
## Development
|
104
82
|
|
105
83
|
- Source hosted on GitHub: https://github.com/guard/guard-test
|
@@ -109,8 +87,8 @@ Pull requests are very welcome! Please try to follow these simple "rules", thoug
|
|
109
87
|
|
110
88
|
- Please create a topic branch for every separate change you make;
|
111
89
|
- Make sure your patches are well tested;
|
112
|
-
- Update the README (if applicable);
|
113
|
-
- Update the CHANGELOG (
|
90
|
+
- Update the [README](https://github.com/guard/guard-test/blob/master/README.md) (if applicable);
|
91
|
+
- Update the [CHANGELOG](https://github.com/guard/guard-test/blob/master/CHANGELOG.md) and add yourself to the list of contributors (see at the bottom of the CHANGELOG for examples);
|
114
92
|
- Please do not change the version number.
|
115
93
|
|
116
94
|
For questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path('../../../', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'test/unit/ui/console/testrunner'
|
5
|
+
require 'guard/test/notifier'
|
6
|
+
|
7
|
+
# Thanks to Adam Sanderson for the really good starting point:
|
8
|
+
# http://endofline.wordpress.com/2008/02/11/a-custom-testrunner-to-scratch-an-itch/
|
9
|
+
#
|
10
|
+
# This class inherits from Test::Unit' standard console TestRunner
|
11
|
+
# I'm just overriding some callbacks methods to strip some outputs and display a notification on end
|
12
|
+
module Guard
|
13
|
+
class Test
|
14
|
+
class GuardTestRunner < ::Test::Unit::UI::Console::TestRunner
|
15
|
+
|
16
|
+
def initialize(suite, options = {})
|
17
|
+
super
|
18
|
+
@color_scheme["pass"] = ::Test::Unit::Color.new("green", :foreground => true, :bold => true)
|
19
|
+
@color_scheme["failure"] = ::Test::Unit::Color.new("red", :foreground => true, :bold => true)
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Test::Unit::UI::Console::TestRunner overrided methods
|
25
|
+
def setup_mediator
|
26
|
+
@mediator = ::Test::Unit::UI::TestRunnerMediator.new(@suite)
|
27
|
+
end
|
28
|
+
|
29
|
+
def started(result)
|
30
|
+
@result = result
|
31
|
+
nl
|
32
|
+
end
|
33
|
+
|
34
|
+
def finished(elapsed_time)
|
35
|
+
super
|
36
|
+
Guard::TestNotifier.notify(@result, elapsed_time)
|
37
|
+
nl
|
38
|
+
end
|
39
|
+
|
40
|
+
def fault_color_name(fault)
|
41
|
+
fault.class.name.split(/::/).last.downcase.to_sym
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Test::Unit::AutoRunner.register_runner(:guard) { |r| Guard::Test::GuardTestRunner }
|