minitag 0.1.0 → 0.2.0

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: 76f72fc7c148e87021a776dea6655c3a676be7878e2fd595f436244d3bf7a998
4
- data.tar.gz: aeea971c7ccab5fe5761e80c9d867b191b954e28693f7ceeedcd6f7d2154036a
3
+ metadata.gz: 683ead8b294111fdcd7f19206a0713fb85bc8ed632aa3a853fcbe72a75abf1d2
4
+ data.tar.gz: 3100c71052cd5fc151f0107d76e1abddcc6fe36d1ec649d3d2fc3c385cc5bfa5
5
5
  SHA512:
6
- metadata.gz: e8d68e32988f3a13a2252b0578cf21efd6630befe8563a21869aa00c58abb63deb7d46d598fb9e6d6740b84b9be9e13214aafd8e1c2f05995ffdca766a380bc2
7
- data.tar.gz: 527b5dcad48e756611bc662a587197ebd3bb257532b34b056c13f47deb2f6d9d4ec19b782c7812adc80cdd088f7e437f27d6066af6d4063ce3ed90fd5b6b00a6
6
+ metadata.gz: a46ab8f1155605202144a8d6c44a4250409cd0ae94670fe1f748b7c08aacac9c937b9ea97488c7131d00f559be2ea52fc99a5cbb4f430f243e7ddaed0cc01b2d
7
+ data.tar.gz: ffa35e8148558a1210e48d92fc3672bae8d46e6eba4f9da49fde5142661af5b90f82d99db56da4d6aa07841b89056ef7012b66da6bbb105ddae64a7a5ea888ae
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitag (0.1.0)
4
+ minitag (0.2.0)
5
5
  minitest (~> 5.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/minitag.svg)](https://badge.fury.io/rb/minitag)
2
+
1
3
  # Minitag
2
4
 
3
5
  [![Build Status](https://travis-ci.org/bernardoamc/minitag.svg?branch=master)](https://travis-ci.org/bernardoamc/minitag)
@@ -11,22 +11,27 @@ require 'minitag/tag_extension'
11
11
  # to Minitest::Test
12
12
  module Minitag
13
13
  class << self
14
+ # Tags specified by the `--tag` or `-t` option.
14
15
  def execution_tags
15
16
  @execution_tags ||= []
16
17
  end
17
18
 
19
+ # Add tag specified by the `--tag` or `-t` option.
18
20
  def add_execution_tag(tag)
19
21
  execution_tags << Tag.new(tag)
20
22
  end
21
23
 
24
+ # Tags from the last `tag` method waiting to be associated with a test.
22
25
  def pending_tags
23
26
  @pending_tags || []
24
27
  end
25
28
 
29
+ # Tags set from the `tag` method.
26
30
  def pending_tags=(tags)
27
31
  @pending_tags = Array(tags)
28
32
  end
29
33
 
34
+ # The mapping of tags and tests.
30
35
  def tag_mapping
31
36
  @tag_mapping ||= Minitag::TagMapper.new
32
37
  end
@@ -9,6 +9,14 @@ module Minitag
9
9
  class Tag
10
10
  attr_reader :name
11
11
 
12
+ # Initializes a tag. Tags with a ~ prefix are deemed exclusive and
13
+ # inclusive otherwise.
14
+ #
15
+ # param [String] name the name of the tag
16
+ #
17
+ # Invariants:
18
+ # - A tag name will always be a String without the ~ prefix
19
+ # after initialization.
12
20
  def initialize(name)
13
21
  @name = name.to_s
14
22
  @exclusive = false
@@ -19,10 +27,16 @@ module Minitag
19
27
  @exclusive = true
20
28
  end
21
29
 
30
+ # Whether this tag needs to be excluded or not.
31
+ #
32
+ # return [boolean]
22
33
  def exclusive?
23
34
  @exclusive
24
35
  end
25
36
 
37
+ # Whether this tag needs to be included or not.
38
+ #
39
+ # return [boolean]
26
40
  def inclusive?
27
41
  !exclusive?
28
42
  end
@@ -3,16 +3,27 @@
3
3
  module Minitag
4
4
  # Stores the mapping between a test name and its existing tags.
5
5
  class TagMapper
6
- attr_reader :repository
7
-
8
6
  def initialize
9
7
  @repository = Hash.new { |h, k| h[k] = [] }
10
8
  end
11
9
 
10
+ # Associates a tag with a test name takinto into account is context.
11
+ #
12
+ # @param [String] context the context which a test name belongs.
13
+ # @param [String] name the test name.
14
+ # @param [String] tag the tag name.
15
+ #
16
+ # @return [void]
12
17
  def add(context:, name:, tag:)
13
18
  @repository[key(context, name)] << Minitag::Tag.new(tag)
14
19
  end
15
20
 
21
+ # Fetches tags associated with a test name and context.
22
+ #
23
+ # @param [String] context the context which a test name belongs.
24
+ # @param [String] name the test name.
25
+ #
26
+ # @return [Array] the tags associated with the test.
16
27
  def fetch(context:, name:)
17
28
  @repository[key(context, name)]
18
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minitag
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo de Araujo