minitest-focus 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d1f0124e972e82828260d1d43b715a95898efa7f
4
- data.tar.gz: 56597a02024c19fcefc4bcf07aec0639a65d23c4
2
+ SHA256:
3
+ metadata.gz: d34869b02e75ef676d3e431756fc9da15e2ff8ca21f22103f00ac5ebe69f3d2c
4
+ data.tar.gz: 6baf632e87f65bc46c46e4acfda4d48bb1871a3b240f132bdd2b85221c119302
5
5
  SHA512:
6
- metadata.gz: 7cc420c75d806196f12b066a787edb14f0592d76c67626849bed8838ebeb448a88668787be4f3211edc471a54dd2632e96c794b527d4f57321e61668a48205ac
7
- data.tar.gz: ca299f64dbfa72cc1d1cb85d5d5350a31ae583fc5d176f9f3bdd716290b56bf4e4d23620962667d06cf7fbbe7fe5acd3c8b4620841328ffaf403b0b57340fa46
6
+ metadata.gz: d988af4b0b1959a4caf4200d484713bbbc9e809282b2f72aee822e8bb89dd9fe20fde2c6e3fbe01be4bc39f5d9cc1573349d1f5bef5a98ec4a043a88266f7b26
7
+ data.tar.gz: d661a7db8d5e6906957b8481d7f59a9f0882b97f44f2d52af0937acdbfd208167e2fbf5015dd0515794e7cf4f324d735b8145486d877c75ae38aac6fdfa48eb4
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.0 / 2021-05-22
2
+
3
+ * 1 major enhancement:
4
+
5
+ * Removed minitest4 support.
6
+
7
+ * 2 minor enhancements:
8
+
9
+ * Added support for `focus def test_method`.
10
+ * Improved documentation for both test- and spec-style.
11
+
12
+ === 1.2.1 / 2020-06-14
13
+
14
+ * 1 bug fix:
15
+
16
+ * Prevent a crash if the gem is installed but never required. (dazuma)
17
+
18
+ === 1.2.0 / 2020-05-15
19
+
20
+ * 1 major enhancement:
21
+
22
+ * Converted to a minitest plugin. (jbourassa)
23
+
24
+ === 1.1.2 / 2015-07-25
25
+
26
+ * 1 bug fix:
27
+
28
+ * Fixed focus handling when run under Rake's rake_test_loader.rb.
29
+
30
+ === 1.1.1 / 2015-03-12
31
+
32
+ * 1 minor enhancement:
33
+
34
+ * Escape method names in filter regexp. (ddiachkov)
35
+
1
36
  === 1.1.0 / 2013-11-07
2
37
 
3
38
  * 1 major enhancement:
@@ -10,4 +45,3 @@
10
45
  * 1 major enhancement
11
46
 
12
47
  * Birthday!
13
-
data/Manifest.txt CHANGED
@@ -4,6 +4,5 @@ Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
6
  lib/minitest/focus.rb
7
- lib/minitest/focus4.rb
8
- lib/minitest/focus5.rb
7
+ lib/minitest/focus_plugin.rb
9
8
  test/minitest/test_focus.rb
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 # only this one will run
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
- def test_method_edgecase; ...; end
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 4.3.4+
45
+ * minitest 5+
37
46
 
38
47
  == INSTALL:
39
48
 
@@ -1,7 +1,59 @@
1
- begin
2
- require "minitest/test"
3
- require "minitest/focus5.rb"
4
- rescue LoadError
5
- require "minitest/unit"
6
- require "minitest/focus4.rb"
1
+ class Minitest::Test # :nodoc:
2
+ class Focus # :nodoc:
3
+ VERSION = "1.3.0" # :nodoc:
4
+ end
5
+
6
+ @@filtered_names = [] # :nodoc:
7
+
8
+ def self.add_to_filter name
9
+ @@filtered_names << "#{self}##{name}"
10
+ end
11
+
12
+ def self.filtered_names
13
+ @@filtered_names
14
+ end
15
+
16
+ ##
17
+ # Focus on the next test defined. Cumulative. Equivalent to
18
+ # running with command line arg: -n /test_name|.../
19
+ #
20
+ # class MyTest < Minitest::Test
21
+ #
22
+ # # direct approach
23
+ # focus def test_method1 # will run
24
+ # ...
25
+ # end
26
+ #
27
+ # # indirect approach
28
+ # focus
29
+ # def test_method2 # will run
30
+ # ...
31
+ # end
32
+ #
33
+ # def test_method3 # will NOT run
34
+ # ...
35
+ # end
36
+ # end
37
+
38
+ def self.focus name = nil
39
+ if name then
40
+ add_to_filter name
41
+ else
42
+ set_focus_trap
43
+ end
44
+ end
45
+
46
+ ##
47
+ # Sets a one-off method_added callback to set focus on the method
48
+ # defined next.
49
+
50
+ def self.set_focus_trap
51
+ meta = class << self; self; end
52
+
53
+ meta.send :define_method, :method_added do |name|
54
+ add_to_filter name
55
+
56
+ meta.send :remove_method, :method_added
57
+ end
58
+ end
7
59
  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
@@ -1,16 +1,19 @@
1
1
  require "minitest/autorun"
2
2
  require "minitest/focus"
3
3
 
4
- test_cls = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase
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
- it "is ignored" do flunk end
14
- focus; it "does something" do pass end
15
- it "bombs" do flunk end
14
+ it "is ignored" do flunk end
15
+ focus; it "does something" do pass end
16
+ focus it("does something else") { pass } # stupid block precedence needs {}
17
+ it "bombs" do flunk end
18
+ focus; it "has non-word ['chars'" do pass end # Will raise invalid RegExp unless correctly escaped
16
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.1.0
4
+ version: 1.3.0
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
- MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBBTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTIwMTIyMjIwMzgzMFoXDTIxMTIyMjIwMzgzMFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -21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CA88Jubw0Sqatan0TnC9g
30
+ KToW560QIey7SPfHWduzFJnV
31
31
  -----END CERTIFICATE-----
32
- date: 2013-11-07 00:00:00.000000000 Z
32
+ date: 2021-05-22 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.7'
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.7'
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,42 +101,39 @@ extra_rdoc_files:
95
101
  - Manifest.txt
96
102
  - README.txt
97
103
  files:
98
- - .autotest
104
+ - ".autotest"
99
105
  - History.txt
100
106
  - Manifest.txt
101
107
  - README.txt
102
108
  - Rakefile
103
109
  - lib/minitest/focus.rb
104
- - lib/minitest/focus4.rb
105
- - lib/minitest/focus5.rb
110
+ - lib/minitest/focus_plugin.rb
106
111
  - test/minitest/test_focus.rb
107
- - .gemtest
108
112
  homepage: https://github.com/seattlerb/minitest-focus
109
113
  licenses:
110
114
  - MIT
111
- metadata: {}
112
- post_install_message:
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
- rubyforge_project: minitest-focus
130
- rubygems_version: 2.1.10
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
135
- test_files:
136
- - test/minitest/test_focus.rb
139
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes
@@ -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] = "/^(#{opts[:names].join "|"})$/"
22
-
23
- meta.send :remove_method, :method_added
24
- end
25
- end
26
- end
@@ -1,37 +0,0 @@
1
- class Minitest::Test # :nodoc:
2
- class Focus # :nodoc:
3
- VERSION = "1.1.0" # :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 = "/^(#{@@filtered_names.join "|"})$/"
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