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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8004bb1833fb4829727720b31f79334793e459d8bcb956914bbd6cddb93c85a2
4
- data.tar.gz: 40271847cdace3dcf99f483d59530b45496fc1a02fc5208e56c6a1f5817c03de
3
+ metadata.gz: '094566c4bff048ad837a295ae4d013c4257e618a1a31086421950bc2b6108320'
4
+ data.tar.gz: 026ec2b8c2297582e79e703b64376949acd4a82ff4b64547b1e3cf03244ca01d
5
5
  SHA512:
6
- metadata.gz: 89b73ed8cdb55e205b3692ebd67c301785ae6e8fb7fcc856c32d0cc863024eb55bbaaa899a439cf1bdb2bef64627f1de7fbc171650dd95b6794ab64f3f6da121
7
- data.tar.gz: 21be5c61d05d203558b664dbe92a08c01ac809b84580ddbf4ac6a648067e175cebb1c9b7912e91673f14f315f789ae11ee09bf653860b4ed67d53262fecd8db0
6
+ metadata.gz: ba85967b4f9529917d6d048d8da4d6e9cc766f32f8efae1265630453fdcd2e4f9605d2839a7904721d899700f2a6e8b570e5b838da93b849f38916b8b4066037
7
+ data.tar.gz: 1eb9624c88014f714dde789e628d78801f1f874d4ddbb87c8abbde62a53727b2189d84e8d06583c65df65e074138ccc0d0dab4e2fccf736cc82c4746ec3c743b
@@ -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 and inclusive filters otherwise.
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 [boolean] whether a context has no filters.
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 [boolean] whether there was a match or not.
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 [boolean] whether there was a match or not.
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 [boolean] whether there was a match or not.
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 tags. This distinction is only valid for tag
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
@@ -3,7 +3,8 @@
3
3
  require 'set'
4
4
 
5
5
  module Minitag
6
- # Stores tags associated with a namespace and name.
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
- # @param [String] namespace the namespace which a test name belongs.
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 namespace which a test name belongs.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minitag
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo de Araujo