minispec-metadata 3.4.0 → 3.5.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -13
- data/lib/minispec-metadata/version.rb +1 -1
- data/minispec-metadata.gemspec +2 -2
- data/spec/describe.spec.rb +18 -18
- data/spec/helper.rb +1 -1
- data/spec/it.spec.rb +11 -11
- data/spec/minispec_metadata.spec.rb +4 -5
- data/spec/regression.spec.rb +3 -3
- data/spec/tags.spec.rb +16 -11
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1060bde642108c75e9aa68ed534f5628ba8eb077f821635c3218c2455688c825
|
4
|
+
data.tar.gz: 9917b7f019e4425e01c17a429f94350228ef3a9197400cb613f321dc83889305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86a661762ddb75c3cb5aff7aead7c55ad1bb2a92152b6038968bb38c0f97978492a5a053221432d895c1f4713d7ac2cb281b40880a119ad59911f0fc1f8f9776
|
7
|
+
data.tar.gz: d0e0e710513fdc9533014e385d6f67d9ba6df3cf97005aacb3c1b823cccf9b68c4a5187741af75f9fb5e6a6d36ae097052c4076c3a89f3e33a951804ec62fb9e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -18,39 +18,39 @@ describe 'Usage', some: 'metadata' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'defines a metadata method', more: 'metadata' do
|
21
|
-
metadata.must_equal(
|
21
|
+
_(metadata).must_equal(
|
22
22
|
some: 'metadata',
|
23
23
|
more: 'metadata',
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'gives priority to closest metadata', some: 'different metadata' do
|
28
|
-
metadata.must_equal(
|
28
|
+
_(metadata).must_equal(
|
29
29
|
some: 'different metadata',
|
30
30
|
)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'provides a method to get the description of the spec' do
|
34
|
-
desc.must_equal 'provides a method to get the description of the spec'
|
34
|
+
_(desc).must_equal 'provides a method to get the description of the spec'
|
35
35
|
end
|
36
36
|
|
37
37
|
describe MinispecMetadata, 'additional description' do
|
38
38
|
|
39
39
|
it 'provides a method to get the descriptions' do
|
40
|
-
self.class.descs.must_equal [MinispecMetadata, 'additional description']
|
40
|
+
_(self.class.descs).must_equal [MinispecMetadata, 'additional description']
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'provides a method to get only the additional description' do
|
44
|
-
self.class.additional_desc.must_equal ['additional description']
|
44
|
+
_(self.class.additional_desc).must_equal ['additional description']
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'is not needed to get the described object' do
|
48
48
|
# This is built in to Minitest, you don't need this gem to do this.
|
49
|
-
self.class.desc.must_equal MinispecMetadata
|
49
|
+
_(self.class.desc).must_equal MinispecMetadata
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'treats additional descriptions as metadata too', meta: 'data' do
|
53
|
-
metadata.must_equal(
|
53
|
+
_(metadata).must_equal(
|
54
54
|
:some => 'metadata',
|
55
55
|
'additional description' => true,
|
56
56
|
:meta => 'data',
|
@@ -61,9 +61,9 @@ describe 'Usage', some: 'metadata' do
|
|
61
61
|
|
62
62
|
# Thanks to @mfpiccolo for this.
|
63
63
|
it 'allows array of symbols like RSpec', :these, :work, :too do
|
64
|
-
metadata[:these].must_equal true
|
65
|
-
metadata[:work].must_equal true
|
66
|
-
metadata[:too].must_equal true
|
64
|
+
_(metadata[:these]).must_equal true
|
65
|
+
_(metadata[:work]).must_equal true
|
66
|
+
_(metadata[:too]).must_equal true
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
@@ -131,6 +131,4 @@ Whatever path you decide to take, do this AFTER you've taken those steps:
|
|
131
131
|
|
132
132
|
## Compatibility
|
133
133
|
|
134
|
-
Tested with Minitest
|
135
|
-
Might work with older versions but I haven't tested them.
|
136
|
-
See .travis for more info.
|
134
|
+
Tested with Minitest 5, Ruby version 3, Rails version 5.1.
|
data/minispec-metadata.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency 'minitest'
|
22
22
|
|
23
|
-
gem.add_development_dependency '
|
24
|
-
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'amazing_print', '~>1.5.0'
|
24
|
+
gem.add_development_dependency 'rake', '~>13.0.6'
|
25
25
|
end
|
data/spec/describe.spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
5
5
|
describe 'as 2nd arg after description', second: '2nd' do
|
6
6
|
|
7
7
|
it 'is accessible with metadata method' do
|
8
|
-
metadata.fetch(:second).must_equal '2nd'
|
8
|
+
_(metadata.fetch(:second)).must_equal '2nd'
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -13,23 +13,23 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
13
13
|
describe 'as 3rd arg after additional description', 'more description', third: '3rd' do
|
14
14
|
|
15
15
|
it 'is accessible with metadata method' do
|
16
|
-
metadata.fetch(:third).must_equal '3rd'
|
16
|
+
_(metadata.fetch(:third)).must_equal '3rd'
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'when just a symbol is passed', :axiom, :vcr do
|
22
22
|
it 'uses symbols as true values' do
|
23
|
-
metadata.fetch(:axiom).must_equal true
|
24
|
-
metadata.fetch(:vcr).must_equal true
|
23
|
+
_(metadata.fetch(:axiom)).must_equal true
|
24
|
+
_(metadata.fetch(:vcr)).must_equal true
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe 'duplicate', first: '1st' do
|
29
29
|
|
30
30
|
it 'correctly scopes metadata to current description' do
|
31
|
-
metadata.must_equal(first: '1st', super_meta: 'data')
|
32
|
-
metadata.key?(:second).must_equal false
|
31
|
+
_(metadata).must_equal(first: '1st', super_meta: 'data')
|
32
|
+
_(metadata.key?(:second)).must_equal false
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
@@ -37,8 +37,8 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
37
37
|
describe 'duplicate', second: '2nd' do
|
38
38
|
|
39
39
|
it 'correctly scopes metadata to current description' do
|
40
|
-
metadata.must_equal(second: '2nd', super_meta: 'data')
|
41
|
-
metadata.key?(:first).must_equal false
|
40
|
+
_(metadata).must_equal(second: '2nd', super_meta: 'data')
|
41
|
+
_(metadata.key?(:first)).must_equal false
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
@@ -46,7 +46,7 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
46
46
|
describe 'nested', sub: 'desc' do
|
47
47
|
|
48
48
|
it 'inherits from surrounding description', lowest: 'totem' do
|
49
|
-
metadata.must_equal(
|
49
|
+
_(metadata).must_equal(
|
50
50
|
super_meta: 'data',
|
51
51
|
sub: 'desc',
|
52
52
|
lowest: 'totem',
|
@@ -54,7 +54,7 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'gives nearest metadata priority', sub: 'zero', super_meta: 'priority' do
|
57
|
-
metadata.must_equal(
|
57
|
+
_(metadata).must_equal(
|
58
58
|
sub: 'zero',
|
59
59
|
super_meta: 'priority',
|
60
60
|
)
|
@@ -65,7 +65,7 @@ describe MinispecMetadata::Describe, super_meta: 'data' do
|
|
65
65
|
desc_class = describe 'return value' do
|
66
66
|
|
67
67
|
it 'equals description class' do
|
68
|
-
desc_class.must_equal self.class
|
68
|
+
_(desc_class).must_equal self.class
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -76,17 +76,17 @@ end
|
|
76
76
|
describe MinispecMetadata::Describe, 'additional description' do
|
77
77
|
|
78
78
|
it 'provides a method to get the descriptions' do
|
79
|
-
self.class.descs.must_equal [MinispecMetadata::Describe, 'additional description']
|
79
|
+
_(self.class.descs).must_equal [MinispecMetadata::Describe, 'additional description']
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'provides a method to get only the additional description' do
|
83
|
-
self.class.additional_desc.must_equal ['additional description']
|
83
|
+
_(self.class.additional_desc).must_equal ['additional description']
|
84
84
|
end
|
85
85
|
|
86
86
|
describe 'nested describe with no additional description' do
|
87
87
|
|
88
88
|
it 'does not inherit additional description from parent' do
|
89
|
-
self.class.additional_desc.must_be_empty
|
89
|
+
_(self.class.additional_desc).must_be_empty
|
90
90
|
end
|
91
91
|
|
92
92
|
end
|
@@ -96,8 +96,8 @@ end
|
|
96
96
|
describe 'stuff', 'more stuff', {even_more: 'stuff'}, :holy_cow_that_is_a_lot_of_stuff, :minitest_5 do
|
97
97
|
|
98
98
|
it 'preserves additional description but still allows any value for metadata', :more? => 'yeah' do
|
99
|
-
self.class.descs.must_equal ['stuff', 'more stuff', {even_more: 'stuff'}, :holy_cow_that_is_a_lot_of_stuff, :minitest_5]
|
100
|
-
metadata.must_equal(
|
99
|
+
_(self.class.descs).must_equal ['stuff', 'more stuff', {even_more: 'stuff'}, :holy_cow_that_is_a_lot_of_stuff, :minitest_5]
|
100
|
+
_(metadata).must_equal(
|
101
101
|
'more stuff' => true,
|
102
102
|
:even_more => 'stuff',
|
103
103
|
:holy_cow_that_is_a_lot_of_stuff => true,
|
@@ -111,8 +111,8 @@ end
|
|
111
111
|
describe MinispecMetadata::Describe, 'additional description', :respect do
|
112
112
|
|
113
113
|
it 'respects additional description' do
|
114
|
-
self.class.name.must_equal 'MinispecMetadata::Describe::additional description::respect'
|
115
|
-
metadata.must_equal(
|
114
|
+
_(self.class.name).must_equal 'MinispecMetadata::Describe::additional description::respect'
|
115
|
+
_(metadata).must_equal(
|
116
116
|
'additional description' => true,
|
117
117
|
:respect => true,
|
118
118
|
)
|
data/spec/helper.rb
CHANGED
data/spec/it.spec.rb
CHANGED
@@ -3,25 +3,25 @@ require_relative 'helper'
|
|
3
3
|
describe MinispecMetadata::It do
|
4
4
|
|
5
5
|
it 'stores metadata for current spec', meta: 'data' do
|
6
|
-
metadata.fetch(:meta).must_equal 'data'
|
6
|
+
_(metadata.fetch(:meta)).must_equal 'data'
|
7
7
|
end
|
8
8
|
|
9
9
|
specify 'it works with #specify', 1 => 2 do
|
10
|
-
metadata.fetch(1).must_equal 2
|
10
|
+
_(metadata.fetch(1)).must_equal 2
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'returns empty hash when no metadata set' do
|
14
|
-
metadata.must_equal({})
|
14
|
+
_(metadata).must_equal({})
|
15
15
|
end
|
16
16
|
|
17
17
|
name = it 'returns name' do
|
18
|
-
name.must_match /test_/
|
18
|
+
_(name).must_match %r/test_/
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'before/after hooks' do
|
22
22
|
|
23
23
|
before do
|
24
|
-
metadata.fetch(:before).must_equal 'accessible'
|
24
|
+
_(metadata.fetch(:before)).must_equal 'accessible'
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'is accessible in hooks', before: 'accessible', after: 'also accessible' do
|
@@ -29,7 +29,7 @@ describe MinispecMetadata::It do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
after do
|
32
|
-
metadata.fetch(:after).must_equal 'also accessible'
|
32
|
+
_(metadata.fetch(:after)).must_equal 'also accessible'
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
@@ -37,11 +37,11 @@ describe MinispecMetadata::It do
|
|
37
37
|
describe 'with description metadata', description_meta: 'data' do
|
38
38
|
|
39
39
|
it 'inherits metadata from description' do
|
40
|
-
metadata.fetch(:description_meta).must_equal 'data'
|
40
|
+
_(metadata.fetch(:description_meta)).must_equal 'data'
|
41
41
|
end
|
42
42
|
|
43
43
|
it "uses symbols as true values", :verity, :words_are_hard do
|
44
|
-
metadata.must_equal(
|
44
|
+
_(metadata).must_equal(
|
45
45
|
description_meta: 'data',
|
46
46
|
verity: true,
|
47
47
|
words_are_hard: true,
|
@@ -51,7 +51,7 @@ describe MinispecMetadata::It do
|
|
51
51
|
describe 'in a nested describe', 'with no metadata' do
|
52
52
|
|
53
53
|
it 'works', works: true do
|
54
|
-
metadata.must_equal(
|
54
|
+
_(metadata).must_equal(
|
55
55
|
:description_meta => 'data',
|
56
56
|
'with no metadata' => true,
|
57
57
|
:works => true,
|
@@ -63,7 +63,7 @@ describe MinispecMetadata::It do
|
|
63
63
|
describe 'in a nested describe', with_metadata: true do
|
64
64
|
|
65
65
|
it 'works', works: true do
|
66
|
-
metadata.must_equal(works: true, with_metadata: true, description_meta: 'data')
|
66
|
+
_(metadata).must_equal(works: true, with_metadata: true, description_meta: 'data')
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
@@ -75,7 +75,7 @@ end
|
|
75
75
|
describe MinispecMetadata::It, '#desc' do
|
76
76
|
|
77
77
|
it 'provides a method to get the name of the spec' do
|
78
|
-
desc.must_equal 'provides a method to get the name of the spec'
|
78
|
+
_(desc).must_equal 'provides a method to get the name of the spec'
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -6,23 +6,22 @@ describe MinispecMetadata do
|
|
6
6
|
|
7
7
|
it 'extracts from a hash' do
|
8
8
|
metadata = MinispecMetadata.extract_metadata [{asdf: true}]
|
9
|
-
metadata.must_equal asdf: true
|
9
|
+
_(metadata).must_equal asdf: true
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'extracts from symbols, returns hash keys with true values' do
|
13
13
|
metadata = MinispecMetadata.extract_metadata [:asdf, :fdsa]
|
14
|
-
metadata.must_equal asdf: true, fdsa: true
|
14
|
+
_(metadata).must_equal asdf: true, fdsa: true
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'extracts a mix' do
|
18
18
|
metadata = MinispecMetadata.extract_metadata [:asdf, {fdsa: true}]
|
19
|
-
metadata.must_equal asdf: true, fdsa: true
|
19
|
+
_(metadata).must_equal asdf: true, fdsa: true
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'does not remove metadata from args' do
|
23
23
|
args = [:asdf, 'description']
|
24
|
-
|
25
|
-
args.must_equal [:asdf, 'description']
|
24
|
+
_(args).must_equal [:asdf, 'description']
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
data/spec/regression.spec.rb
CHANGED
@@ -5,14 +5,14 @@ require_relative 'helper'
|
|
5
5
|
describe "top level describe" do
|
6
6
|
describe "an inner describe" do
|
7
7
|
before do
|
8
|
-
desc.wont_be_nil
|
8
|
+
_(desc).wont_be_nil
|
9
9
|
end
|
10
10
|
it "an example inside inner describe" do
|
11
|
-
desc.must_equal 'an example inside inner describe'
|
11
|
+
_(desc).must_equal 'an example inside inner describe'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "another top level example" do
|
16
|
-
desc.must_equal 'another top level example'
|
16
|
+
_(desc).must_equal 'another top level example'
|
17
17
|
end
|
18
18
|
end
|
data/spec/tags.spec.rb
CHANGED
@@ -5,31 +5,36 @@ module MinispecMetadata
|
|
5
5
|
|
6
6
|
it 'captures the metadata key' do
|
7
7
|
tag = Tag.new('~sure')
|
8
|
-
tag.key.must_equal 'sure'
|
9
|
-
tag.value
|
8
|
+
_(tag.key).must_equal( 'sure')
|
9
|
+
_(tag.value?).must_equal false
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'captures metadata key/value' do
|
13
13
|
tag = Tag.new('key:value')
|
14
|
-
tag.key.must_equal 'key'
|
15
|
-
tag.value.must_equal 'value'
|
14
|
+
_(tag.key).must_equal( 'key')
|
15
|
+
_(tag.value).must_equal( 'value')
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'captures inclusivity' do
|
19
19
|
tag = Tag.new('sure')
|
20
|
-
tag.must_be :inclusive?
|
20
|
+
_(tag).must_be :inclusive?
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'captures exclusivity' do
|
24
24
|
tag = Tag.new('~sure')
|
25
|
-
tag.must_be :exclusive?
|
25
|
+
_(tag).must_be :exclusive?
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'captures exclusivity' do
|
29
|
+
tag = Tag.new('~sure')
|
30
|
+
_(tag).must_be :exclusive?
|
26
31
|
end
|
27
32
|
|
28
33
|
end
|
29
34
|
|
30
35
|
TAGS_TEST = describe Tags do
|
31
36
|
def self.passing_test(*args)
|
32
|
-
it
|
37
|
+
it(*args) do
|
33
38
|
pass
|
34
39
|
end
|
35
40
|
end
|
@@ -52,17 +57,17 @@ module MinispecMetadata
|
|
52
57
|
end
|
53
58
|
|
54
59
|
def strip_prefix(name)
|
55
|
-
name.sub /^test_\d{4}_/, ''
|
60
|
+
name.sub %r/^test_\d{4}_/, ''
|
56
61
|
end
|
57
62
|
|
58
63
|
def self.assert_runnable_methods_with_tags(tag_strings, expected_runnable_methods)
|
59
64
|
it "returns runnable_methods with tag_strings #{tag_strings.inspect}" do
|
60
65
|
stub_tags tag_strings do
|
61
|
-
TAGS_TEST
|
66
|
+
_(TAGS_TEST
|
62
67
|
.runnable_methods
|
63
68
|
.map(&method(:strip_prefix))
|
64
|
-
.sort
|
65
|
-
|
69
|
+
.sort)
|
70
|
+
.must_equal expected_runnable_methods
|
66
71
|
end
|
67
72
|
end
|
68
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minispec-metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Ning
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: amazing_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.5.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 13.0.6
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 13.0.6
|
55
55
|
description: Minitest::Spec metadata
|
56
56
|
email:
|
57
57
|
- jared@redningja.com
|