minitag 0.3.0 → 0.3.1
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/lib/minitag/context.rb +8 -6
- data/lib/minitag/tag_extension.rb +2 -2
- data/lib/minitag/tag_registry.rb +8 -5
- data/lib/minitag/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '094566c4bff048ad837a295ae4d013c4257e618a1a31086421950bc2b6108320'
|
|
4
|
+
data.tar.gz: 026ec2b8c2297582e79e703b64376949acd4a82ff4b64547b1e3cf03244ca01d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba85967b4f9529917d6d048d8da4d6e9cc766f32f8efae1265630453fdcd2e4f9605d2839a7904721d899700f2a6e8b570e5b838da93b849f38916b8b4066037
|
|
7
|
+
data.tar.gz: 1eb9624c88014f714dde789e628d78801f1f874d4ddbb87c8abbde62a53727b2189d84e8d06583c65df65e074138ccc0d0dab4e2fccf736cc82c4746ec3c743b
|
data/lib/minitag/context.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Minitag
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Adds a filter tag.
|
|
27
|
-
# Tags with a ~ prefix are exclusive filters
|
|
27
|
+
# Tags with a ~ prefix are treated as exclusive filters or inclusive filters otherwise.
|
|
28
28
|
#
|
|
29
29
|
# param [String] name the name of the filter tag.
|
|
30
30
|
#
|
|
@@ -42,13 +42,15 @@ module Minitag
|
|
|
42
42
|
|
|
43
43
|
# Indicates when a context has no filters.
|
|
44
44
|
#
|
|
45
|
-
# @return [
|
|
45
|
+
# @return [Boolean] whether a context has no filters.
|
|
46
46
|
def no_filters?
|
|
47
47
|
@inclusive_filters.empty? && @exclusive_filters.empty?
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
# Detects whether the name associated with a namespace contains tags
|
|
51
|
-
# that matches the filtering criteria.
|
|
51
|
+
# that matches the filtering criteria. For more information check the methods:
|
|
52
|
+
# - match_inclusive_filters?
|
|
53
|
+
# - match_exclusive_filters?
|
|
52
54
|
#
|
|
53
55
|
# @param [String] namespace the namespace which a test name belongs.
|
|
54
56
|
# @param [String] name the test name.
|
|
@@ -56,7 +58,7 @@ module Minitag
|
|
|
56
58
|
# Invariants:
|
|
57
59
|
# - Returns true when no filters are present.
|
|
58
60
|
#
|
|
59
|
-
# return [
|
|
61
|
+
# @return [Boolean] whether there was a match or not.
|
|
60
62
|
def match?(namespace:, name:)
|
|
61
63
|
return true if no_filters?
|
|
62
64
|
|
|
@@ -75,7 +77,7 @@ module Minitag
|
|
|
75
77
|
# - Returns false when inclusive filters are specified but there
|
|
76
78
|
# are no tags.
|
|
77
79
|
#
|
|
78
|
-
# return [
|
|
80
|
+
# @return [Boolean] whether there was a match or not.
|
|
79
81
|
def match_inclusive_filters?(tags)
|
|
80
82
|
return true if @inclusive_filters.empty?
|
|
81
83
|
return false if @inclusive_filters.any? && tags.empty?
|
|
@@ -92,7 +94,7 @@ module Minitag
|
|
|
92
94
|
# - Returns true when exclusive filters are specified and there
|
|
93
95
|
# are no tags.
|
|
94
96
|
#
|
|
95
|
-
# return [
|
|
97
|
+
# return [Boolean] whether there was a match or not.
|
|
96
98
|
def match_exclusive_filters?(tags)
|
|
97
99
|
return true if @exclusive_filters.empty?
|
|
98
100
|
return true if @exclusive_filters.any? && tags.empty?
|
|
@@ -10,12 +10,12 @@ module Minitag
|
|
|
10
10
|
# Add tags to be associated with the next test definition.
|
|
11
11
|
#
|
|
12
12
|
# It is important to notice that tags associated with a test have no concept
|
|
13
|
-
# of inclusive or exclusive
|
|
13
|
+
# of being inclusive or exclusive. This distinction is only valid for tag
|
|
14
14
|
# filters.
|
|
15
15
|
#
|
|
16
16
|
# @param [Array] tags the list of tags to be associated with a test case.
|
|
17
17
|
#
|
|
18
|
-
# return [void]
|
|
18
|
+
# @return [void]
|
|
19
19
|
def tag(*tags)
|
|
20
20
|
Minitag.pending_tags = tags.map { |tag| tag.to_s.strip.downcase }
|
|
21
21
|
end
|
data/lib/minitag/tag_registry.rb
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
require 'set'
|
|
4
4
|
|
|
5
5
|
module Minitag
|
|
6
|
-
# Stores tags associated with a
|
|
6
|
+
# Stores tags associated with a test name, which belongs to a namespace.
|
|
7
|
+
# The namespace is usually the class which the test belongs to.
|
|
7
8
|
class TagRegistry
|
|
8
9
|
def initialize
|
|
9
10
|
@repository = Hash.new { |h, k| h[k] = Set.new }
|
|
@@ -11,9 +12,11 @@ module Minitag
|
|
|
11
12
|
|
|
12
13
|
# Associates tags with a name taking into account its namespace.
|
|
13
14
|
#
|
|
14
|
-
#
|
|
15
|
+
# Duplicated tags will be removed during this operation.
|
|
16
|
+
#
|
|
17
|
+
# @param [String] namespace the context which a test name belongs.
|
|
15
18
|
# @param [String] name the test name.
|
|
16
|
-
# @param [Array] tags the collection of tags.
|
|
19
|
+
# @param [Array] tags the collection of tags associated with a test.
|
|
17
20
|
#
|
|
18
21
|
# @return [void]
|
|
19
22
|
def add(namespace:, name:, tags:)
|
|
@@ -22,10 +25,10 @@ module Minitag
|
|
|
22
25
|
|
|
23
26
|
# Fetches tags associated with a test name and namespace.
|
|
24
27
|
#
|
|
25
|
-
# @param [String] namespace the
|
|
28
|
+
# @param [String] namespace the context which a test name belongs.
|
|
26
29
|
# @param [String] name the test name.
|
|
27
30
|
#
|
|
28
|
-
# @return [Set] the tags associated with the specified namespace and name.
|
|
31
|
+
# @return [Set] the tags associated with the specified namespace and test name.
|
|
29
32
|
def fetch(namespace:, name:)
|
|
30
33
|
@repository[key(namespace, name)]
|
|
31
34
|
end
|
data/lib/minitag/version.rb
CHANGED