minitest-focus 1.1.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +35 -1
- data/Manifest.txt +1 -2
- data/README.txt +13 -4
- data/lib/minitest/focus.rb +60 -6
- data/lib/minitest/focus_plugin.rb +18 -0
- data/test/minitest/test_focus.rb +5 -3
- metadata +38 -34
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/lib/minitest/focus4.rb +0 -26
- data/lib/minitest/focus5.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 34dbd2617058d83323bc7e66b0fc842b4bc7d3bcdbc89a53c5338d0a0c2ac50c
|
4
|
+
data.tar.gz: bd8aa9bef1a614ae2620f45ecf85b6dcdfe8858a93b846c31af4f4d8b32d59e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f19c7c909942e9ce71dce0f734f316dcfd98d5b8cc64088454611d4aa1055dd7547be06ea7c000db44b314477d5104c2bf79155a687a9d545e903fd100b705
|
7
|
+
data.tar.gz: 4cc6a394a4f36d153bafe5b83753f2a90c045621b592964eb5c706eb72700166e04c05076fa59de9f4b4a8cb58e6eaa0265feda76682dcd596a71ec4e308af6b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
=== 1.3.1 / 2021-05-26
|
2
|
+
|
3
|
+
* 1 bug fix:
|
4
|
+
|
5
|
+
* Fixed missing require. (ryanseys)
|
6
|
+
|
7
|
+
=== 1.3.0 / 2021-05-22
|
8
|
+
|
9
|
+
* 1 major enhancement:
|
10
|
+
|
11
|
+
* Removed minitest4 support.
|
12
|
+
|
13
|
+
* 2 minor enhancements:
|
14
|
+
|
15
|
+
* Added support for `focus def test_method`.
|
16
|
+
* Improved documentation for both test- and spec-style.
|
17
|
+
|
18
|
+
=== 1.2.1 / 2020-06-14
|
19
|
+
|
20
|
+
* 1 bug fix:
|
21
|
+
|
22
|
+
* Prevent a crash if the gem is installed but never required. (dazuma)
|
23
|
+
|
24
|
+
=== 1.2.0 / 2020-05-15
|
25
|
+
|
26
|
+
* 1 major enhancement:
|
27
|
+
|
28
|
+
* Converted to a minitest plugin. (jbourassa)
|
29
|
+
|
30
|
+
=== 1.1.2 / 2015-07-25
|
31
|
+
|
32
|
+
* 1 bug fix:
|
33
|
+
|
34
|
+
* Fixed focus handling when run under Rake's rake_test_loader.rb.
|
35
|
+
|
1
36
|
=== 1.1.1 / 2015-03-12
|
2
37
|
|
3
38
|
* 1 minor enhancement:
|
@@ -16,4 +51,3 @@
|
|
16
51
|
* 1 major enhancement
|
17
52
|
|
18
53
|
* Birthday!
|
19
|
-
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -23,17 +23,26 @@ Inspired by https://github.com/seattlerb/minitest/issues/213
|
|
23
23
|
require "minitest/focus"
|
24
24
|
|
25
25
|
class MyTest < MiniTest::Unit::TestCase
|
26
|
-
def test_unrelated; ...; end
|
26
|
+
def test_unrelated; ...; end # will NOT run
|
27
|
+
|
28
|
+
focus def test_method2; ...; end # will run (direct--preferred)
|
27
29
|
|
28
30
|
focus
|
29
|
-
def test_method; ...; end
|
31
|
+
def test_method; ...; end # will run (indirect)
|
32
|
+
|
33
|
+
def test_method_edgecase; ...; end # will NOT run
|
34
|
+
end
|
35
|
+
|
36
|
+
# or, with spec-style:
|
30
37
|
|
31
|
-
|
38
|
+
describe "MyTest2" do
|
39
|
+
focus; it "does something" do pass end
|
40
|
+
focus it("does something else") { pass } # block precedence needs {}
|
32
41
|
end
|
33
42
|
|
34
43
|
== REQUIREMENTS:
|
35
44
|
|
36
|
-
* minitest
|
45
|
+
* minitest 5+
|
37
46
|
|
38
47
|
== INSTALL:
|
39
48
|
|
data/lib/minitest/focus.rb
CHANGED
@@ -1,7 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require "minitest/test"
|
2
|
+
|
3
|
+
class Minitest::Test # :nodoc:
|
4
|
+
class Focus # :nodoc:
|
5
|
+
VERSION = "1.3.1" # :nodoc:
|
6
|
+
end
|
7
|
+
|
8
|
+
@@filtered_names = [] # :nodoc:
|
9
|
+
|
10
|
+
def self.add_to_filter name
|
11
|
+
@@filtered_names << "#{self}##{name}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.filtered_names
|
15
|
+
@@filtered_names
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Focus on the next test defined. Cumulative. Equivalent to
|
20
|
+
# running with command line arg: -n /test_name|.../
|
21
|
+
#
|
22
|
+
# class MyTest < Minitest::Test
|
23
|
+
#
|
24
|
+
# # direct approach
|
25
|
+
# focus def test_method1 # will run
|
26
|
+
# ...
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# # indirect approach
|
30
|
+
# focus
|
31
|
+
# def test_method2 # will run
|
32
|
+
# ...
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def test_method3 # will NOT run
|
36
|
+
# ...
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
|
40
|
+
def self.focus name = nil
|
41
|
+
if name then
|
42
|
+
add_to_filter name
|
43
|
+
else
|
44
|
+
set_focus_trap
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Sets a one-off method_added callback to set focus on the method
|
50
|
+
# defined next.
|
51
|
+
|
52
|
+
def self.set_focus_trap
|
53
|
+
meta = class << self; self; end
|
54
|
+
|
55
|
+
meta.send :define_method, :method_added do |name|
|
56
|
+
add_to_filter name
|
57
|
+
|
58
|
+
meta.send :remove_method, :method_added
|
59
|
+
end
|
60
|
+
end
|
7
61
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Minitest
|
4
|
+
def self.plugin_focus_options(_opts, options)
|
5
|
+
return unless Minitest::Test.respond_to? :filtered_names
|
6
|
+
return if Minitest::Test.filtered_names.empty?
|
7
|
+
|
8
|
+
index = ARGV.index { |arg| arg =~ /^-n/ || arg =~ /^--name/ }
|
9
|
+
if index
|
10
|
+
warn 'Ignoring -n / --name, using `focus` filters instead'
|
11
|
+
ARGV.delete_at index
|
12
|
+
end
|
13
|
+
|
14
|
+
re = "/^(#{Regexp.union(Minitest::Test.filtered_names).source})$/"
|
15
|
+
|
16
|
+
options[:filter] = re
|
17
|
+
end
|
18
|
+
end
|
data/test/minitest/test_focus.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
require "minitest/autorun"
|
2
2
|
require "minitest/focus"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
class MyTest1 < test_cls
|
4
|
+
class MyTest1 < Minitest::Test
|
7
5
|
def test_fail; flunk; end
|
8
6
|
focus; def test_method; pass; end
|
7
|
+
focus def test_method2; pass; end
|
8
|
+
focus \
|
9
|
+
def test_method3; pass; end
|
9
10
|
def test_method_edgecase; flunk; end
|
10
11
|
end
|
11
12
|
|
12
13
|
describe "MyTest2" do
|
13
14
|
it "is ignored" do flunk end
|
14
15
|
focus; it "does something" do pass end
|
16
|
+
focus it("does something else") { pass } # stupid block precedence needs {}
|
15
17
|
it "bombs" do flunk end
|
16
18
|
focus; it "has non-word ['chars'" do pass end # Will raise invalid RegExp unless correctly escaped
|
17
19
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-focus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBBTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTIwMTIyMjIwMzgzMFoXDTIxMTIyMjIwMzgzMFowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -21,64 +21,70 @@ cert_chain:
|
|
21
21
|
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
|
-
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
+
AQAE3XRm1YZcCVjAJy5yMZvTOFrS7B2SYErc+0QwmKYbHztTTDY2m5Bii+jhpuxh
|
26
|
+
H+ETcU1z8TUKLpsBUP4kUpIRowkVN1p/jKapV8T3Rbwq+VuYFe+GMKsf8wGZSecG
|
27
|
+
oMQ8DzzauZfbvhe2kDg7G9BBPU0wLQlY25rDcCy9bLnD7R0UK3ONqpwvsI5I7x5X
|
28
|
+
ZIMXR0a9/DG+55mawwdGzCQobDKiSNLK89KK7OcNTALKU0DfgdTkktdgKchzKHqZ
|
29
|
+
d/AHw/kcnU6iuMUoJEcGiJd4gVCTn1l3cDcIvxakGslCA88Jubw0Sqatan0TnC9g
|
30
|
+
KToW560QIey7SPfHWduzFJnV
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: minitest
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4'
|
41
|
-
- - <
|
41
|
+
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '6'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '4'
|
51
|
-
- - <
|
51
|
+
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '6'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: rdoc
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '4.0'
|
61
|
+
- - "<"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '7'
|
61
64
|
type: :development
|
62
65
|
prerelease: false
|
63
66
|
version_requirements: !ruby/object:Gem::Requirement
|
64
67
|
requirements:
|
65
|
-
- -
|
68
|
+
- - ">="
|
66
69
|
- !ruby/object:Gem::Version
|
67
70
|
version: '4.0'
|
71
|
+
- - "<"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '7'
|
68
74
|
- !ruby/object:Gem::Dependency
|
69
75
|
name: hoe
|
70
76
|
requirement: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
|
-
- - ~>
|
78
|
+
- - "~>"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '3.
|
80
|
+
version: '3.22'
|
75
81
|
type: :development
|
76
82
|
prerelease: false
|
77
83
|
version_requirements: !ruby/object:Gem::Requirement
|
78
84
|
requirements:
|
79
|
-
- - ~>
|
85
|
+
- - "~>"
|
80
86
|
- !ruby/object:Gem::Version
|
81
|
-
version: '3.
|
87
|
+
version: '3.22'
|
82
88
|
description: |-
|
83
89
|
Allows you to focus on a few tests with ease without having to use
|
84
90
|
command-line arguments. Good for tools like guard that don't have
|
@@ -95,40 +101,38 @@ extra_rdoc_files:
|
|
95
101
|
- Manifest.txt
|
96
102
|
- README.txt
|
97
103
|
files:
|
98
|
-
- .autotest
|
99
|
-
- .gemtest
|
104
|
+
- ".autotest"
|
100
105
|
- History.txt
|
101
106
|
- Manifest.txt
|
102
107
|
- README.txt
|
103
108
|
- Rakefile
|
104
109
|
- lib/minitest/focus.rb
|
105
|
-
- lib/minitest/
|
106
|
-
- lib/minitest/focus5.rb
|
110
|
+
- lib/minitest/focus_plugin.rb
|
107
111
|
- test/minitest/test_focus.rb
|
108
112
|
homepage: https://github.com/seattlerb/minitest-focus
|
109
113
|
licenses:
|
110
114
|
- MIT
|
111
|
-
metadata:
|
112
|
-
|
115
|
+
metadata:
|
116
|
+
homepage_uri: https://github.com/seattlerb/minitest-focus
|
117
|
+
post_install_message:
|
113
118
|
rdoc_options:
|
114
|
-
- --main
|
119
|
+
- "--main"
|
115
120
|
- README.txt
|
116
121
|
require_paths:
|
117
122
|
- lib
|
118
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
124
|
requirements:
|
120
|
-
- -
|
125
|
+
- - ">="
|
121
126
|
- !ruby/object:Gem::Version
|
122
127
|
version: '0'
|
123
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
129
|
requirements:
|
125
|
-
- -
|
130
|
+
- - ">="
|
126
131
|
- !ruby/object:Gem::Version
|
127
132
|
version: '0'
|
128
133
|
requirements: []
|
129
|
-
|
130
|
-
|
131
|
-
signing_key:
|
134
|
+
rubygems_version: 3.2.16
|
135
|
+
signing_key:
|
132
136
|
specification_version: 4
|
133
137
|
summary: Allows you to focus on a few tests with ease without having to use command-line
|
134
138
|
arguments
|
metadata.gz.sig
CHANGED
Binary file
|
data/.gemtest
DELETED
File without changes
|
data/lib/minitest/focus4.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class MiniTest::Unit::TestCase # :nodoc:
|
2
|
-
##
|
3
|
-
# Focus on the next test defined. Cumulative. Equivalent to
|
4
|
-
# running with command line arg: -n /test_name|.../
|
5
|
-
#
|
6
|
-
# class MyTest < MiniTest::Unit::TestCase
|
7
|
-
# ...
|
8
|
-
# focus
|
9
|
-
# def test_pass; ... end # this one will run
|
10
|
-
# ...
|
11
|
-
# end
|
12
|
-
|
13
|
-
def self.focus
|
14
|
-
opts = MiniTest::Unit.runner.options
|
15
|
-
meta = class << self; self; end
|
16
|
-
|
17
|
-
opts[:names] ||= []
|
18
|
-
|
19
|
-
meta.send :define_method, :method_added do |name|
|
20
|
-
opts[:names] << name.to_s
|
21
|
-
opts[:filter] = "/^(#{Regexp.union(opts[:names]).source})$/"
|
22
|
-
|
23
|
-
meta.send :remove_method, :method_added
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/minitest/focus5.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
class Minitest::Test # :nodoc:
|
2
|
-
class Focus # :nodoc:
|
3
|
-
VERSION = "1.1.1" # :nodoc:
|
4
|
-
end
|
5
|
-
|
6
|
-
@@filtered_names = [] # :nodoc:
|
7
|
-
|
8
|
-
##
|
9
|
-
# Focus on the next test defined. Cumulative. Equivalent to
|
10
|
-
# running with command line arg: -n /test_name|.../
|
11
|
-
#
|
12
|
-
# class MyTest < MiniTest::Unit::TestCase
|
13
|
-
# ...
|
14
|
-
# focus
|
15
|
-
# def test_pass; ... end # this one will run
|
16
|
-
# ...
|
17
|
-
# end
|
18
|
-
|
19
|
-
def self.focus
|
20
|
-
meta = class << self; self; end
|
21
|
-
|
22
|
-
meta.send :define_method, :method_added do |name|
|
23
|
-
@@filtered_names << "#{self}##{name}"
|
24
|
-
filter = "/^(#{Regexp.union(@@filtered_names).source})$/"
|
25
|
-
|
26
|
-
index = ARGV.index("-n")
|
27
|
-
unless index then
|
28
|
-
index = ARGV.size
|
29
|
-
ARGV << "-n"
|
30
|
-
end
|
31
|
-
|
32
|
-
ARGV[index + 1] = filter
|
33
|
-
|
34
|
-
meta.send :remove_method, :method_added
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|