minitest-tagz 1.5.3 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minitest/tagz.rb +32 -37
- data/lib/minitest/tagz/version.rb +1 -1
- data/minitest-tagz.gemspec +0 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 347d2a3aa8e7d5e66ee59e3372e69d78901ca244c6504cbbf2bdfe52e6e11b1e
|
4
|
+
data.tar.gz: e56b65e7fc29a800855af0e267faa14104c19b2d846f002469411740a3c47ef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d7067bf81f5f82a8d9693779e6ab60c482e528082bad305103473e1ce81c7b9c11d0b0602f298fa441601d497294b19d08c2bf9854ef485c5ce6def3df86afc
|
7
|
+
data.tar.gz: 6ca7806d80a96c8dbfa2409e84e5161d74d51bad13faa10c4e4c696982b9ac34f6f268cc1941aacfbb4d5ec8ee61b2508ab3af0efe461b8da5c1e8dc300b54b5
|
data/lib/minitest/tagz.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'minitest'
|
2
2
|
require 'minitest/tagz/version'
|
3
|
-
require 'state_machines'
|
4
3
|
|
5
4
|
module Minitest
|
6
5
|
module Tagz
|
@@ -100,21 +99,9 @@ module Minitest
|
|
100
99
|
# It is essentially a state machine that works with the
|
101
100
|
# patcher to patch and unpatch Minitest properly
|
102
101
|
class Tagger
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
event :tags_declared do
|
108
|
-
transition :awaiting_tag_declaration => :awaiting_test_definition
|
109
|
-
end
|
110
|
-
|
111
|
-
event :initial_test_definition_encountered do
|
112
|
-
transition :awaiting_test_definition => :applying_tags
|
113
|
-
end
|
114
|
-
|
115
|
-
event :finished_applying_tags do
|
116
|
-
transition :applying_tags => :finished
|
117
|
-
end
|
102
|
+
def tags_declared
|
103
|
+
patch_test_definitions
|
104
|
+
@awaiting_initial_test_definition = true
|
118
105
|
end
|
119
106
|
|
120
107
|
attr_reader :patchers, :owner, :pending_tags
|
@@ -135,10 +122,10 @@ module Minitest
|
|
135
122
|
end
|
136
123
|
|
137
124
|
def handle_initial_test_definition
|
138
|
-
is_initial =
|
139
|
-
|
125
|
+
is_initial = @awaiting_initial_test_definition
|
126
|
+
@awaiting_initial_test_definition = false if is_initial
|
140
127
|
res = yield
|
141
|
-
|
128
|
+
unpatch_test_definitions if is_initial
|
142
129
|
res
|
143
130
|
end
|
144
131
|
end
|
@@ -165,42 +152,51 @@ module Minitest
|
|
165
152
|
end
|
166
153
|
|
167
154
|
def patch_minitest_test(state_machine)
|
168
|
-
@old_method_added = old_method_added = Minitest::Test.method(:method_added)
|
169
155
|
Minitest::Test.class_eval do
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
156
|
+
self.singleton_class.class_eval do
|
157
|
+
alias :old_method_added :method_added
|
158
|
+
|
159
|
+
define_method(:method_added) do |name|
|
160
|
+
if name[/^test_/]
|
161
|
+
state_machine.handle_initial_test_definition do
|
162
|
+
Tagz::RunnerStrategy.tag_map ||= {}
|
163
|
+
Tagz::RunnerStrategy.tag_map[Tagz::RunnerStrategy.serialize(self, name)] ||= []
|
164
|
+
Tagz::RunnerStrategy.tag_map[Tagz::RunnerStrategy.serialize(self, name)] += state_machine.pending_tags
|
165
|
+
old_method_added(name)
|
166
|
+
end
|
167
|
+
else
|
168
|
+
old_method_added(name)
|
177
169
|
end
|
178
|
-
else
|
179
|
-
old_method_added.call(name)
|
180
170
|
end
|
181
171
|
end
|
182
172
|
end
|
183
173
|
end
|
184
174
|
|
185
175
|
def unpatch_minitest_test
|
186
|
-
Minitest::Test.
|
176
|
+
Minitest::Test.class_eval do
|
177
|
+
self.singleton_class.class_eval do
|
178
|
+
undef_method :method_added
|
179
|
+
alias :method_added :old_method_added
|
180
|
+
end
|
181
|
+
end
|
187
182
|
end
|
188
183
|
|
189
184
|
def patch_minitest_spec(state_machine)
|
190
|
-
@old_describe = old_describe = Kernel.instance_method(:describe)
|
191
185
|
Kernel.module_eval do
|
186
|
+
alias :old_describe :describe
|
187
|
+
|
192
188
|
define_method(:describe) do |*args, &block|
|
193
189
|
state_machine.handle_initial_test_definition do
|
194
|
-
old_describe
|
190
|
+
old_describe(*args, &block)
|
195
191
|
end
|
196
192
|
end
|
197
193
|
end
|
198
194
|
end
|
199
195
|
|
200
196
|
def unpatch_minitest_spec
|
201
|
-
old_describe = @old_describe
|
202
197
|
Kernel.module_eval do
|
203
|
-
|
198
|
+
undef_method :describe
|
199
|
+
alias :describe :old_describe
|
204
200
|
end
|
205
201
|
end
|
206
202
|
end
|
@@ -208,7 +204,7 @@ module Minitest
|
|
208
204
|
|
209
205
|
# Main extensions to Minitest
|
210
206
|
class << self
|
211
|
-
attr_accessor :
|
207
|
+
attr_accessor :run_all_if_no_match, :log_if_no_match
|
212
208
|
|
213
209
|
alias :run_all_if_no_match? :run_all_if_no_match
|
214
210
|
alias :log_if_no_match? :log_if_no_match
|
@@ -225,7 +221,7 @@ module Minitest
|
|
225
221
|
end
|
226
222
|
|
227
223
|
def chosen_tags
|
228
|
-
@chosen_tags
|
224
|
+
@chosen_tags ||= []
|
229
225
|
end
|
230
226
|
|
231
227
|
def positive_tags
|
@@ -239,7 +235,6 @@ module Minitest
|
|
239
235
|
def declare_tag_assignment(owner, pending_tags)
|
240
236
|
tag_machine = TaggerFactory.create_tagger(owner, pending_tags)
|
241
237
|
tag_machine.tags_declared
|
242
|
-
# TODO add debugging tip about this
|
243
238
|
tag_machine
|
244
239
|
end
|
245
240
|
end
|
data/minitest-tagz.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-tagz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Bodah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: state_machines
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
134
|
version: '0'
|
149
135
|
requirements: []
|
150
136
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.7.
|
137
|
+
rubygems_version: 2.7.3
|
152
138
|
signing_key:
|
153
139
|
specification_version: 4
|
154
140
|
summary: yet another tags implementation for Minitest
|