minitest-tagz 1.2.3 → 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
2
  SHA1:
3
- metadata.gz: 646a201db2965019d16719b1d9afdda0dc6f89cd
4
- data.tar.gz: e152068769c5010e89375dffa17e89f326dd68ac
3
+ metadata.gz: 149d2f07923982e3796977d1a3153ddd835971c3
4
+ data.tar.gz: 37a69269c8b29c887c6a8d903473ddc71ace505a
5
5
  SHA512:
6
- metadata.gz: c4dec20676294d509be5e832e12079fb0f7aa074b218b7aa3d714dbbdd6c31206b4fee7ad4cfa89e7852a6d28769ed21bcb54c78960534e6aad77233a6dc79e6
7
- data.tar.gz: 4fd7a3a61c09e0a12a13e1016be7295b4fae6ac82782a2e76da3109e90e6c322ed448ae512404a5ebc79c9a273c7067e5ad61627f21c24df40c8a5960c7e9df7
6
+ metadata.gz: 247eae22cbd95e61fa89dc70b5a1d4ad33a6c32a76af50edab6cb0d276e13034140acdd1b1ab047b3f352e3468b0d40ffef80020363615d12309905bf74d50e7
7
+ data.tar.gz: 14aaeb31fe597504c47d3a727d3c7923169f1c1584e74427ea1cd606de223d2be2da96ae803e2d22d070ba88abb1d084a72694603d386fade420d111d6d168f2
data/README.md CHANGED
@@ -35,6 +35,13 @@ Then, for example, you can run all tests with the `:fast` and `:login` tags:
35
35
  bundle exec rake test TAGS=fast,login
36
36
  ```
37
37
 
38
+ You can also run all test without a particular tag or mix any subset.
39
+ Below we run all the `:fast` tags, but not the `:login` tags
40
+
41
+ ```rb
42
+ bundle exec rake test TAGS=-login,fast
43
+ ```
44
+
38
45
  Here's another example which will allow you to drop in a `:focus` tag wherever you want:
39
46
 
40
47
  ```rb
data/lib/minitest/tagz.rb CHANGED
@@ -13,16 +13,26 @@ module Minitest
13
13
  module RunnableMethodsFilter
14
14
  def runnable_methods
15
15
  all_runnables = super
16
- if Tagz.chosen_tags && Tagz.chosen_tags.any?
17
- all_runnables.select do |r|
16
+
17
+ if Tagz.positive_tags.any?
18
+ all_runnables.select! do |r|
19
+ serialized = MinitestRunnerStrategy.serialize(self, r)
20
+ tags_on_runnable = MinitestRunnerStrategy.tag_map[serialized]
21
+ next false unless tags_on_runnable
22
+ (Tagz.positive_tags - tags_on_runnable).empty?
23
+ end
24
+ end
25
+
26
+ if Tagz.negative_tags.any?
27
+ all_runnables.reject! do |r|
18
28
  serialized = MinitestRunnerStrategy.serialize(self, r)
19
29
  tags_on_runnable = MinitestRunnerStrategy.tag_map[serialized]
20
30
  next false unless tags_on_runnable
21
- (Tagz.chosen_tags - tags_on_runnable).empty?
31
+ (Tagz.negative_tags & tags_on_runnable).any?
22
32
  end
23
- else
24
- all_runnables
25
33
  end
34
+
35
+ all_runnables
26
36
  end
27
37
  end
28
38
 
@@ -108,7 +118,7 @@ module Minitest
108
118
  def initialize(patchers, owner, pending_tags)
109
119
  @patchers = patchers
110
120
  @owner = owner
111
- @pending_tags = pending_tags
121
+ @pending_tags = pending_tags.map(&:to_s)
112
122
  super()
113
123
  end
114
124
 
@@ -201,11 +211,23 @@ module Minitest
201
211
  # @param [Boolean] run_all_if_no_match - will run all tests if no tests are found with the tag
202
212
  # @param [Boolean] log_if_no_match - puts if no match specs found
203
213
  def choose_tags(*tags, log_if_no_match: false, run_all_if_no_match: false)
204
- @chosen_tags = tags.map(&:to_sym)
214
+ @chosen_tags = tags.map(&:to_s)
205
215
  @run_all_if_no_match = run_all_if_no_match
206
216
  @log_if_no_match = log_if_no_match
207
217
  end
208
218
 
219
+ def chosen_tags
220
+ @chosen_tags || []
221
+ end
222
+
223
+ def positive_tags
224
+ chosen_tags.reject {|t| t.is_a?(String) && t[/^-/]}
225
+ end
226
+
227
+ def negative_tags
228
+ chosen_tags.select {|t| t.is_a?(String) && t[/^-/]}.map {|t| t[1..-1]}
229
+ end
230
+
209
231
  def declare_tag_assignment(owner, pending_tags)
210
232
  tag_machine = TaggerFactory.create_tagger(owner, pending_tags)
211
233
  tag_machine.tags_declared
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Tagz
3
- VERSION = "1.2.3"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "guard"
29
29
  spec.add_development_dependency "guard-minitest"
30
+ spec.add_development_dependency "byebug"
30
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-tagz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Bodah
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: allows you to tag different Minitest tests with tags that can be used
112
126
  to filter tests
113
127
  email: