mcmire-guard-minitest 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +71 -0
- data/LICENSE +20 -0
- data/README.md +112 -0
- data/lib/guard/minitest.rb +42 -0
- data/lib/guard/minitest/inspector.rb +70 -0
- data/lib/guard/minitest/notifier.rb +41 -0
- data/lib/guard/minitest/runner.rb +118 -0
- data/lib/guard/minitest/runners/default_runner.rb +13 -0
- data/lib/guard/minitest/runners/suite_runner.rb +22 -0
- data/lib/guard/minitest/runners/version_1_runner.rb +17 -0
- data/lib/guard/minitest/runners/version_2_runner.rb +22 -0
- data/lib/guard/minitest/templates/Guardfile +21 -0
- data/lib/guard/minitest/version.rb +6 -0
- metadata +117 -0
data/CHANGELOG.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
## 1.0.0 (next major release)
|
2
|
+
|
3
|
+
Upgrade to match Guard 1.0 API:
|
4
|
+
|
5
|
+
* Deprecate `:notify` option, use guard notification configuration (Yann
|
6
|
+
Lugrin)
|
7
|
+
|
8
|
+
Features:
|
9
|
+
|
10
|
+
* Add `:cli` option and deprecate `:seed` and `:verbose` options (Yann
|
11
|
+
Lugrin)
|
12
|
+
|
13
|
+
## 0.5.0 (Feb 24, 2012)
|
14
|
+
|
15
|
+
Bug Fixes:
|
16
|
+
|
17
|
+
* Hard coded tests folders path (Nathan Youngman)
|
18
|
+
* Watch subfolder in Guardfile template (Wilker Lúcio, Mark Kremer)
|
19
|
+
* Notification work with DRB (Brian Morearty)
|
20
|
+
* Initialized constant with ruby 1.9 (Jonas Grimfelt)
|
21
|
+
|
22
|
+
Features:
|
23
|
+
|
24
|
+
* Option to overwrite test folders and test files pattern (japgolly)
|
25
|
+
|
26
|
+
## 0.4.0 (Jun 15, 2011)
|
27
|
+
|
28
|
+
Features:
|
29
|
+
|
30
|
+
* Support of MiniTest 2 (Yann Lugrin)
|
31
|
+
* DRB support (Oriol Gual)
|
32
|
+
* Use regexp in Guardfile Template (Emmanuel Gomez)
|
33
|
+
|
34
|
+
Dependencies:
|
35
|
+
|
36
|
+
* Need guard 0.4 (Yann Lugrin)
|
37
|
+
|
38
|
+
## 0.3.0 (Oct 27, 2010)
|
39
|
+
|
40
|
+
Bug Fixes:
|
41
|
+
|
42
|
+
* All guard API action return a boolean value
|
43
|
+
* Depends on guard 0.2.2 to fix darwin watching problems
|
44
|
+
|
45
|
+
Features:
|
46
|
+
|
47
|
+
* Desktop notification can be disabled
|
48
|
+
* Bundler usage can be disabled
|
49
|
+
* Rubygems usage can be enable (only if bundler is not present or disable)
|
50
|
+
|
51
|
+
## 0.2.2 (Oct 24, 2010)
|
52
|
+
|
53
|
+
Bug Fixes:
|
54
|
+
|
55
|
+
* Depends on guard 0.2.1 to fix linux watching probalems
|
56
|
+
* Remove duplicate code
|
57
|
+
|
58
|
+
## 0.2.1 (Oct 22, 2010)
|
59
|
+
|
60
|
+
Bug Fixes:
|
61
|
+
|
62
|
+
* Don't set minitest seed option by default
|
63
|
+
|
64
|
+
Documentation:
|
65
|
+
|
66
|
+
* Tested on ruby 1.8.6
|
67
|
+
|
68
|
+
## 0.2.0 (Oct 20, 2010)
|
69
|
+
|
70
|
+
First stable release
|
71
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Yann Lugrin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
Guard::Minitest [](http://travis-ci.org/guard/guard-minitest)
|
2
|
+
===============
|
3
|
+
|
4
|
+
Minitest guard allows to automatically & intelligently launch tests with
|
5
|
+
[minitest framework](http://github.com/seattlerb/minitest) when files are modified.
|
6
|
+
|
7
|
+
* Compatible with MiniTest 1.7.x & 2.x
|
8
|
+
* Tested on Ruby 1.8.7, 1.9.2 & 1.9.3
|
9
|
+
|
10
|
+
Install
|
11
|
+
-------
|
12
|
+
|
13
|
+
Please be sure to have [Guard](http://github.com/guard/guard) installed before continue.
|
14
|
+
|
15
|
+
Install the gem:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
gem install guard-minitest
|
19
|
+
```
|
20
|
+
|
21
|
+
Add it to your Gemfile (inside test group):
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'guard-minitest'
|
25
|
+
```
|
26
|
+
|
27
|
+
Add guard definition to your Guardfile by running this command:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
guard init minitest
|
31
|
+
```
|
32
|
+
|
33
|
+
Usage
|
34
|
+
-----
|
35
|
+
|
36
|
+
Please read [Guard usage doc](http://github.com/guard/guard#readme)
|
37
|
+
|
38
|
+
Guardfile
|
39
|
+
---------
|
40
|
+
|
41
|
+
Minitest guard can be really adapated to all kind of projects.
|
42
|
+
Please read {guard doc}[http://github.com/guard/guard#readme] for more info about Guardfile DSL.
|
43
|
+
|
44
|
+
### Standard ruby gems with Minitest::Unit
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
guard 'minitest' do
|
48
|
+
watch(%r|^test/test_(.*)\.rb|)
|
49
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
50
|
+
watch(%r|^test/test_helper\.rb|) { "test" }
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
### Standard ruby gems with Minitest::Spec
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
guard 'minitest' do
|
58
|
+
watch(%r|^spec/(.*)_spec\.rb|)
|
59
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
60
|
+
watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
Options
|
65
|
+
-------
|
66
|
+
|
67
|
+
You can change the default location and pattern of minitest files:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do
|
71
|
+
# ...
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
You can pass any of the standard MiniTest CLI options using the :cli option:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
guard 'minitest', :cli => "--seed 123456 --verbose" do
|
79
|
+
# ...
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
If you use {spork-testunit}[https://github.com/sporkrb/spork-testunit] you can enable it with (you'll have to load it before):
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
guard 'minitest', :drb => true do
|
87
|
+
# ...
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
### List of available options:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
:notify => false # disable desktop notifications
|
95
|
+
:bundler => false # don't use "bundle exec" to run the minitest command, default: true
|
96
|
+
:rubygems => true # require rubygems when run the minitest command (only if bundler is disabled), default: false
|
97
|
+
```
|
98
|
+
|
99
|
+
Development
|
100
|
+
-----------
|
101
|
+
|
102
|
+
* Source hosted on [GitHub](http://github.com/guard/guard-minitest)
|
103
|
+
* Report issues/Questions/Feature requests on [GitHub Issues](http://github.com/guard/guard-minitest/issues)
|
104
|
+
|
105
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
106
|
+
you make.
|
107
|
+
|
108
|
+
Authors
|
109
|
+
-------
|
110
|
+
|
111
|
+
[Yann Lugrin](http://github.com/yannlugrin)
|
112
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'guard'
|
3
|
+
require 'guard/guard'
|
4
|
+
|
5
|
+
module Guard
|
6
|
+
class Minitest < Guard
|
7
|
+
|
8
|
+
autoload :Runner, 'guard/minitest/runner'
|
9
|
+
autoload :Inspector, 'guard/minitest/inspector'
|
10
|
+
|
11
|
+
def initialize(watchers = [], options = {})
|
12
|
+
super
|
13
|
+
|
14
|
+
@runner = Runner.new(options)
|
15
|
+
@inspector = Inspector.new(@runner.test_folders, @runner.test_file_patterns)
|
16
|
+
end
|
17
|
+
|
18
|
+
def start
|
19
|
+
true
|
20
|
+
end
|
21
|
+
|
22
|
+
def stop
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def reload
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def run_all
|
31
|
+
paths = @inspector.clean_all
|
32
|
+
return @runner.run(paths, :message => 'Running all tests') unless paths.empty?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def run_on_change(paths = [])
|
37
|
+
paths = @inspector.clean(paths)
|
38
|
+
return @runner.run(paths) unless paths.empty?
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Guard
|
3
|
+
class Minitest
|
4
|
+
class Inspector
|
5
|
+
|
6
|
+
attr_reader :test_folders, :test_file_patterns
|
7
|
+
|
8
|
+
def initialize(test_folders, test_file_patterns)
|
9
|
+
@test_folders = test_folders.uniq.compact.freeze
|
10
|
+
@test_file_patterns = test_file_patterns.uniq.compact.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def clean_all
|
14
|
+
clean self.test_folders
|
15
|
+
end
|
16
|
+
|
17
|
+
def clean(paths)
|
18
|
+
paths = paths.uniq.compact unless paths == @test_folders
|
19
|
+
paths = paths.select { |p| test_file?(p) || test_folder?(p) }
|
20
|
+
|
21
|
+
paths.dup.each do |path|
|
22
|
+
if File.directory?(path)
|
23
|
+
paths.delete(path)
|
24
|
+
paths += test_files_for_pathes([path])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
paths.uniq!
|
29
|
+
paths.compact!
|
30
|
+
clear_test_files_list
|
31
|
+
paths
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def test_folder_regex
|
36
|
+
@test_folder_regex ||= (
|
37
|
+
folders= self.test_folders.map {|f| Regexp.quote f}.join '|'
|
38
|
+
Regexp.new("^/?(?:#{folders})(?:/|$)")
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_folder?(path)
|
43
|
+
path.match(test_folder_regex) && !path.match(/\..+$/) && File.directory?(path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_file?(path)
|
47
|
+
test_files.include?(path)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_files
|
51
|
+
@test_files ||= test_files_for_pathes(self.test_folders)
|
52
|
+
end
|
53
|
+
|
54
|
+
def join_for_glob(fragments)
|
55
|
+
"{#{fragments.join ','}}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_files_for_pathes(pathes)
|
59
|
+
pathes= join_for_glob(pathes)
|
60
|
+
files= join_for_glob(self.test_file_patterns)
|
61
|
+
Dir.glob(pathes + '/**/' + files)
|
62
|
+
end
|
63
|
+
|
64
|
+
def clear_test_files_list
|
65
|
+
@test_files = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'guard/notifier'
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
class MinitestNotifier
|
6
|
+
|
7
|
+
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
8
|
+
message = "#{test_count} examples, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
9
|
+
if skip_count > 0
|
10
|
+
message << " (#{skip_count} skips)"
|
11
|
+
end
|
12
|
+
if test_count && assertion_count
|
13
|
+
message << "\nin %.6f seconds, %.4f tests/s, %.4f assertions/s." % [duration, test_count / duration, assertion_count / duration]
|
14
|
+
end
|
15
|
+
message
|
16
|
+
end
|
17
|
+
|
18
|
+
# failed | pending (skip) | success
|
19
|
+
def self.guard_image(failure_count, skip_count)
|
20
|
+
icon = if failure_count > 0
|
21
|
+
:failed
|
22
|
+
elsif skip_count > 0
|
23
|
+
:pending
|
24
|
+
else
|
25
|
+
:success
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
30
|
+
message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
31
|
+
image = guard_image(failure_count + error_count, skip_count)
|
32
|
+
|
33
|
+
::Guard::Notifier.notify(message, :title => 'MiniTest results', :image => image) if notify?
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.notify?
|
37
|
+
ENV['GUARD_NOTIFY'] && ENV['GUARD_NOTIFY'] == 'true'
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Guard
|
3
|
+
class Minitest
|
4
|
+
class Runner
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def run(paths = [], options = {})
|
9
|
+
Runner.new(options).run(paths, options)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
parse_deprecated_options(options)
|
16
|
+
|
17
|
+
@options = {
|
18
|
+
:bundler => File.exist?("#{Dir.pwd}/Gemfile"),
|
19
|
+
:rubygems => false,
|
20
|
+
:drb => false,
|
21
|
+
:test_folders => %w[test spec],
|
22
|
+
:test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
|
23
|
+
:cli => ''
|
24
|
+
}.merge(options)
|
25
|
+
[:test_folders,:test_file_patterns].each {|k| (@options[k]= [@options[k]].flatten.uniq.compact).freeze}
|
26
|
+
options= options.freeze
|
27
|
+
end
|
28
|
+
|
29
|
+
def run(paths, options = {})
|
30
|
+
message = options[:message] || "Running: #{paths.join(' ')}"
|
31
|
+
UI.info message, :reset => true
|
32
|
+
system(minitest_command(paths))
|
33
|
+
end
|
34
|
+
|
35
|
+
def cli_options
|
36
|
+
@options[:cli] ||= ''
|
37
|
+
end
|
38
|
+
|
39
|
+
def verbose?
|
40
|
+
@options[:cli].include?('--verbose')
|
41
|
+
end
|
42
|
+
|
43
|
+
def notify?
|
44
|
+
!!@options[:notification]
|
45
|
+
end
|
46
|
+
|
47
|
+
def bundler?
|
48
|
+
@options[:bundler]
|
49
|
+
end
|
50
|
+
|
51
|
+
def rubygems?
|
52
|
+
!bundler? && @options[:rubygems]
|
53
|
+
end
|
54
|
+
|
55
|
+
def drb?
|
56
|
+
@options[:drb]
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_folders
|
60
|
+
@options[:test_folders]
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_file_patterns
|
64
|
+
@options[:test_file_patterns]
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def minitest_command(paths)
|
70
|
+
cmd_parts = []
|
71
|
+
|
72
|
+
cmd_parts << "bundle exec" if bundler?
|
73
|
+
if drb?
|
74
|
+
cmd_parts << "GUARD_NOTIFY=#{notify?.inspect}"
|
75
|
+
cmd_parts << 'testdrb'
|
76
|
+
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
|
77
|
+
test_folders.each do |f|
|
78
|
+
cmd_parts << "#{f}/test_helper.rb" if File.exist?("#{f}/test_helper.rb")
|
79
|
+
cmd_parts << "#{f}/spec_helper.rb" if File.exist?("#{f}/spec_helper.rb")
|
80
|
+
end
|
81
|
+
cmd_parts += paths.map{|path| "./#{path}" }
|
82
|
+
else
|
83
|
+
cmd_parts << 'ruby'
|
84
|
+
cmd_parts += test_folders.map{|f| %[-I"#{f}"] }
|
85
|
+
cmd_parts << '-r rubygems' if rubygems?
|
86
|
+
cmd_parts << '-r bundler/setup' if bundler?
|
87
|
+
cmd_parts += paths.map{|path| "-r ./#{path}" }
|
88
|
+
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
|
89
|
+
cmd_parts << '-e \'MiniTest::Unit.autorun\''
|
90
|
+
cmd_parts << '--' << cli_options unless cli_options.empty?
|
91
|
+
end
|
92
|
+
|
93
|
+
cmd_parts.join(' ')
|
94
|
+
end
|
95
|
+
|
96
|
+
def parse_deprecated_options(options)
|
97
|
+
options[:cli] ||= ''
|
98
|
+
|
99
|
+
if value = options.delete(:notify)
|
100
|
+
options[:notification] = value
|
101
|
+
UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
|
102
|
+
end
|
103
|
+
|
104
|
+
[:seed, :verbose].each do |key|
|
105
|
+
if value = options.delete(key)
|
106
|
+
options[:cli] << " --#{key}"
|
107
|
+
if ![TrueClass, FalseClass].include?(value.class)
|
108
|
+
options[:cli] << " #{value}"
|
109
|
+
end
|
110
|
+
|
111
|
+
UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to MiniTest with the :cli option.}
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'minitest/unit'
|
3
|
+
|
4
|
+
case
|
5
|
+
when MiniTest.const_defined?(:SuiteRunner)
|
6
|
+
load File.expand_path('../suite_runner.rb', __FILE__)
|
7
|
+
when MiniTest::Unit::VERSION =~ /^1/
|
8
|
+
load File.expand_path('../version_1_runner.rb', __FILE__)
|
9
|
+
when MiniTest::Unit::VERSION =~ /^2/
|
10
|
+
load File.expand_path('../version_2_runner.rb', __FILE__)
|
11
|
+
else
|
12
|
+
raise "Unknown MiniTest runner version!"
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'minitest/unit'
|
3
|
+
require 'guard/minitest/notifier'
|
4
|
+
|
5
|
+
module MiniTest
|
6
|
+
class SuiteRunner
|
7
|
+
|
8
|
+
begin
|
9
|
+
alias_method :_run_anything_without_guard, :_run_anything
|
10
|
+
def _run_anything(type)
|
11
|
+
start = Time.now
|
12
|
+
_run_anything_without_guard(type)
|
13
|
+
duration = Time.now - start
|
14
|
+
::Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration)
|
15
|
+
end
|
16
|
+
rescue NameError
|
17
|
+
puts "*** WARN: if you use MiniTest 1, please add version option in your 'Guardfile`."
|
18
|
+
raise
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'minitest/unit'
|
3
|
+
require 'guard/minitest/notifier'
|
4
|
+
|
5
|
+
module MiniTest
|
6
|
+
class MiniTest::Unit
|
7
|
+
|
8
|
+
alias_method :run_without_guard, :run
|
9
|
+
def run(args = [])
|
10
|
+
start = Time.now
|
11
|
+
run_without_guard(args)
|
12
|
+
duration = Time.now - start
|
13
|
+
::Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'minitest/unit'
|
3
|
+
require 'guard/minitest/notifier'
|
4
|
+
|
5
|
+
module MiniTest
|
6
|
+
class MiniTest::Unit
|
7
|
+
|
8
|
+
begin
|
9
|
+
alias_method :_run_anything_without_guard, :_run_anything
|
10
|
+
def _run_anything(type)
|
11
|
+
start = Time.now
|
12
|
+
_run_anything_without_guard(type)
|
13
|
+
duration = Time.now - start
|
14
|
+
::Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration)
|
15
|
+
end
|
16
|
+
rescue NameError
|
17
|
+
puts "*** WARN: if you use MiniTest 1, please add version option in your 'Guardfile`."
|
18
|
+
raise
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
guard 'minitest' do
|
2
|
+
# with Minitest::Unit
|
3
|
+
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
|
4
|
+
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
5
|
+
watch(%r|^test/test_helper\.rb|) { "test" }
|
6
|
+
|
7
|
+
# with Minitest::Spec
|
8
|
+
# watch(%r|^spec/(.*)_spec\.rb|)
|
9
|
+
# watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
10
|
+
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
11
|
+
|
12
|
+
# Rails 3.2
|
13
|
+
# watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
|
14
|
+
# watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
|
15
|
+
# watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
|
16
|
+
|
17
|
+
# Rails
|
18
|
+
# watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" }
|
19
|
+
# watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
|
20
|
+
# watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mcmire-guard-minitest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yann Lugrin
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: &70268232286840 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70268232286840
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70268232285620 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70268232285620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
requirement: &70268232284580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.1'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70268232284580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: &70268232283040 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70268232283040
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: mocha
|
60
|
+
requirement: &70268232281980 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.10'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70268232281980
|
69
|
+
description: Guard::Minitest automatically run your tests with MiniTest framework
|
70
|
+
(much like autotest)
|
71
|
+
email:
|
72
|
+
- yann.lugrin@sans-savoir.net
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- lib/guard/minitest/inspector.rb
|
78
|
+
- lib/guard/minitest/notifier.rb
|
79
|
+
- lib/guard/minitest/runner.rb
|
80
|
+
- lib/guard/minitest/runners/default_runner.rb
|
81
|
+
- lib/guard/minitest/runners/suite_runner.rb
|
82
|
+
- lib/guard/minitest/runners/version_1_runner.rb
|
83
|
+
- lib/guard/minitest/runners/version_2_runner.rb
|
84
|
+
- lib/guard/minitest/templates/Guardfile
|
85
|
+
- lib/guard/minitest/version.rb
|
86
|
+
- lib/guard/minitest.rb
|
87
|
+
- LICENSE
|
88
|
+
- README.md
|
89
|
+
- CHANGELOG.md
|
90
|
+
homepage: http://rubygems.org/gems/guard-minitest
|
91
|
+
licenses: []
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options:
|
94
|
+
- --charset=UTF-8
|
95
|
+
- --main=README.rdoc
|
96
|
+
- --exclude='(lib|test|spec)|(Gem|Guard|Rake)file'
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.6
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project: mcmire-guard-minitest
|
113
|
+
rubygems_version: 1.8.11
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Guard gem for MiniTest framework
|
117
|
+
test_files: []
|