guard-minitest 2.1.3 → 2.2.0
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.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/guard/minitest.rb +8 -12
- data/lib/guard/minitest/inspector.rb +6 -6
- data/lib/guard/minitest/runner.rb +39 -6
- data/lib/guard/minitest/templates/Guardfile +15 -15
- data/lib/guard/minitest/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a09241c76a0ba099f355b5e3eaab0f2c19f70f9
|
4
|
+
data.tar.gz: 7ccf0058158fead7d166775673bb6c195d378ba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aab8e10cc6c4e63086298a1ed20e309192ba73121ea0b8b5c9b61869ce6dbfebf10e67a4fd65e6257cc8dd0cbc33ae3822e8d95a6f36c9667495c747644a06c
|
7
|
+
data.tar.gz: d018ea3126b79602c3931a30a225362da779d3959fa36e5a5a620ba393c54da06228595c83c42a5d3252e31012d84800a43bd20871b3453cd6eab7b5f0aa3865
|
data/README.md
CHANGED
@@ -70,9 +70,9 @@ Please read [guard doc](http://github.com/guard/guard#readme) for more info abou
|
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
guard :minitest do
|
73
|
-
watch(%r{^test/(.*)\/?test_(.*)\.rb})
|
74
|
-
watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
75
|
-
watch(%r{^test/test_helper\.rb}) { 'test' }
|
73
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
74
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
75
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
76
76
|
end
|
77
77
|
```
|
78
78
|
|
@@ -80,9 +80,9 @@ end
|
|
80
80
|
|
81
81
|
```ruby
|
82
82
|
guard :minitest do
|
83
|
-
watch(%r{^spec/(.*)_spec\.rb})
|
84
|
-
watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
|
85
|
-
watch(%r{^spec/spec_helper\.rb}) { 'spec' }
|
83
|
+
watch(%r{^spec/(.*)_spec\.rb$})
|
84
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
85
|
+
watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
86
86
|
end
|
87
87
|
```
|
88
88
|
|
@@ -92,6 +92,7 @@ end
|
|
92
92
|
|
93
93
|
```ruby
|
94
94
|
all_on_start: false # run all tests in group on startup, default: true
|
95
|
+
all_after_pass: true # run all tests in group after changed specs pass, default: false
|
95
96
|
cli: '--test' # pass arbitrary Minitest CLI arguments, default: ''
|
96
97
|
test_folders: ['tests'] # specify an array of paths that contain test files, default: %w[test spec]
|
97
98
|
include: ['lib'] # specify an array of include paths to the command that runs the tests
|
data/lib/guard/minitest.rb
CHANGED
@@ -4,19 +4,18 @@ require 'guard/plugin'
|
|
4
4
|
module Guard
|
5
5
|
class Minitest < Plugin
|
6
6
|
|
7
|
-
require 'guard/minitest/inspector'
|
8
7
|
require 'guard/minitest/runner'
|
9
8
|
require 'guard/minitest/utils'
|
10
9
|
require 'guard/minitest/version'
|
11
10
|
|
11
|
+
attr_accessor :runner
|
12
|
+
|
12
13
|
def initialize(options = {})
|
13
14
|
super
|
14
15
|
@options = {
|
15
16
|
all_on_start: true
|
16
17
|
}.merge(options)
|
17
|
-
|
18
|
-
@runner = Runner.new(@options)
|
19
|
-
@inspector = Inspector.new(@runner.test_folders, @runner.test_file_patterns)
|
18
|
+
@runner = Runner.new(@options)
|
20
19
|
end
|
21
20
|
|
22
21
|
def start
|
@@ -33,22 +32,19 @@ module Guard
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def run_all
|
36
|
-
|
37
|
-
@runner.run(paths, message: 'Running all tests')
|
35
|
+
runner.run_all
|
38
36
|
end
|
39
37
|
|
40
|
-
def
|
41
|
-
|
42
|
-
@runner.run(paths)
|
38
|
+
def run_on_modifications(paths = [])
|
39
|
+
runner.run_on_modifications(paths)
|
43
40
|
end
|
44
41
|
|
45
42
|
def run_on_additions(paths)
|
46
|
-
|
47
|
-
@runner.run(paths)
|
43
|
+
runner.run_on_additions(paths)
|
48
44
|
end
|
49
45
|
|
50
46
|
def run_on_removals(paths)
|
51
|
-
|
47
|
+
runner.run_on_removals(paths)
|
52
48
|
end
|
53
49
|
|
54
50
|
end
|
@@ -25,7 +25,11 @@ module Guard
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def clear_memoized_test_files
|
28
|
-
@
|
28
|
+
@all_test_files = nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def all_test_files
|
32
|
+
@all_test_files ||= _test_files_for_paths
|
29
33
|
end
|
30
34
|
|
31
35
|
private
|
@@ -37,12 +41,8 @@ module Guard
|
|
37
41
|
Dir["#{paths}/**/#{files}"]
|
38
42
|
end
|
39
43
|
|
40
|
-
def _all_test_files
|
41
|
-
@_all_test_files ||= _test_files_for_paths
|
42
|
-
end
|
43
|
-
|
44
44
|
def _test_file?(path)
|
45
|
-
|
45
|
+
_test_files_for_paths.include?(path)
|
46
46
|
end
|
47
47
|
|
48
48
|
def _join_for_glob(fragments)
|
@@ -1,13 +1,13 @@
|
|
1
|
+
require 'guard/minitest/inspector'
|
2
|
+
|
1
3
|
module Guard
|
2
4
|
class Minitest
|
3
5
|
class Runner
|
4
|
-
|
5
|
-
def self.run(paths = [], options = {})
|
6
|
-
new(options).run(paths, options)
|
7
|
-
end
|
6
|
+
attr_accessor :inspector
|
8
7
|
|
9
8
|
def initialize(options = {})
|
10
9
|
@options = {
|
10
|
+
all_after_pass: false,
|
11
11
|
bundler: File.exist?("#{Dir.pwd}/Gemfile"),
|
12
12
|
rubygems: false,
|
13
13
|
drb: false,
|
@@ -24,10 +24,12 @@ module Guard
|
|
24
24
|
[:test_folders, :test_file_patterns].each do |k|
|
25
25
|
@options[k] = Array(@options[k]).uniq.compact
|
26
26
|
end
|
27
|
+
|
28
|
+
@inspector = Inspector.new(test_folders, test_file_patterns)
|
27
29
|
end
|
28
30
|
|
29
31
|
def run(paths, options = {})
|
30
|
-
message = options[:
|
32
|
+
message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
|
31
33
|
UI.info message, reset: true
|
32
34
|
|
33
35
|
status = if bundler?
|
@@ -48,7 +50,30 @@ module Guard
|
|
48
50
|
::Guard::Notifier.notify(message, title: 'Minitest results', image: status ? :success : :failed)
|
49
51
|
end
|
50
52
|
|
51
|
-
status
|
53
|
+
if @options[:all_after_pass] && status && !options[:all]
|
54
|
+
run_all
|
55
|
+
else
|
56
|
+
status
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def run_all
|
61
|
+
paths = inspector.clean_all
|
62
|
+
run(paths, all: true)
|
63
|
+
end
|
64
|
+
|
65
|
+
def run_on_modifications(paths = [])
|
66
|
+
paths = inspector.clean(paths)
|
67
|
+
run(paths, all: all_paths?(paths))
|
68
|
+
end
|
69
|
+
|
70
|
+
def run_on_additions(paths)
|
71
|
+
inspector.clear_memoized_test_files
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
def run_on_removals(paths)
|
76
|
+
inspector.clear_memoized_test_files
|
52
77
|
end
|
53
78
|
|
54
79
|
def cli_options
|
@@ -75,6 +100,10 @@ module Guard
|
|
75
100
|
@options[:spring].is_a?(String) || @options[:spring]
|
76
101
|
end
|
77
102
|
|
103
|
+
def all_after_pass?
|
104
|
+
@options[:all_after_pass]
|
105
|
+
end
|
106
|
+
|
78
107
|
def test_folders
|
79
108
|
@options[:test_folders]
|
80
109
|
end
|
@@ -156,6 +185,10 @@ module Guard
|
|
156
185
|
paths.map { |p| "./#{p}" }
|
157
186
|
end
|
158
187
|
|
188
|
+
def all_paths?(paths)
|
189
|
+
paths == inspector.all_test_files
|
190
|
+
end
|
191
|
+
|
159
192
|
def parse_deprecated_options
|
160
193
|
if @options.key?(:notify)
|
161
194
|
UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
|
@@ -1,25 +1,25 @@
|
|
1
1
|
guard :minitest do
|
2
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' }
|
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
6
|
|
7
7
|
# with Minitest::Spec
|
8
|
-
# watch(%r{^spec/(.*)_spec\.rb})
|
9
|
-
# watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
|
-
# watch(%r{^spec/spec_helper\.rb}) { 'spec' }
|
8
|
+
# watch(%r{^spec/(.*)_spec\.rb$})
|
9
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
|
+
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
11
11
|
|
12
12
|
# Rails 4
|
13
|
-
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
14
|
-
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
|
15
|
-
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
|
13
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
14
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
15
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
16
16
|
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
17
|
-
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
|
18
|
-
# watch(%r{^test/.+_test\.rb})
|
19
|
-
# watch(%r{^test/test_helper\.rb}) { 'test' }
|
17
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
18
|
+
# watch(%r{^test/.+_test\.rb$})
|
19
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
20
20
|
|
21
21
|
# Rails < 4
|
22
|
-
# watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
|
23
|
-
# watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
24
|
-
# watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
|
22
|
+
# watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
23
|
+
# watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
24
|
+
# watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yann Lugrin
|
@@ -9,48 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '2.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: minitest
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '3.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '3.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
description: Guard::Minitest automatically run your tests with Minitest framework
|
@@ -61,6 +61,10 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- CHANGELOG.md
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- lib/guard/minitest.rb
|
64
68
|
- lib/guard/minitest/inspector.rb
|
65
69
|
- lib/guard/minitest/notifier.rb
|
66
70
|
- lib/guard/minitest/reporter.rb
|
@@ -70,11 +74,7 @@ files:
|
|
70
74
|
- lib/guard/minitest/templates/Guardfile
|
71
75
|
- lib/guard/minitest/utils.rb
|
72
76
|
- lib/guard/minitest/version.rb
|
73
|
-
- lib/guard/minitest.rb
|
74
77
|
- lib/minitest/guard_minitest_plugin.rb
|
75
|
-
- CHANGELOG.md
|
76
|
-
- LICENSE
|
77
|
-
- README.md
|
78
78
|
homepage: https://rubygems.org/gems/guard-minitest
|
79
79
|
licenses:
|
80
80
|
- MIT
|
@@ -85,17 +85,17 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 1.9.2
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.0
|
98
|
+
rubygems_version: 2.2.0
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Guard plugin for the Minitest framework
|