minitest-data 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +30 -0
- data/.github/workflows/gem_push.yml +26 -0
- data/LICENSE.txt +1 -1
- data/README.md +10 -12
- data/lib/minitest/data/version.rb +1 -1
- data/lib/minitest/data.rb +43 -22
- data/minitest-data.gemspec +5 -3
- metadata +19 -18
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eec628de98b48f266e2290641d865f3e7aea7c3792fe89c3dfeb74420ba08feb
|
4
|
+
data.tar.gz: feb381c2618f7e980ea697f4674f694f447a6dc8b7625ad1b0e8aa16d4e69430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46af50910ccd2d93a0ebca974c4e4885e3d86de841957f518d400fb7d049b0c61fbae635849f0819fad77471feb463b74117c7558b4071d6f3f0eebebb34d147
|
7
|
+
data.tar.gz: 31af3baa8e4e8ca07effa37c50f72b5ec29e98a6d4153f1e34cc07e3c2ea047de9ebfbdfbede8dcdbcb59af7dd375894e92c58f2b18763d3fbf9a31603b1acf4
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
pull_request:
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby:
|
17
|
+
- '3.0'
|
18
|
+
- '3.1'
|
19
|
+
- '3.2'
|
20
|
+
- '3.3'
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v4
|
24
|
+
- name: Set up Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
bundler-cache: true
|
29
|
+
- name: Run the default task
|
30
|
+
run: bundle exec rake
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Push gem to RubyGems.org
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
push:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
permissions:
|
11
|
+
contents: write
|
12
|
+
id-token: write
|
13
|
+
|
14
|
+
steps:
|
15
|
+
# Set up
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
with:
|
18
|
+
submodules: true
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
bundler-cache: true
|
23
|
+
ruby-version: ruby
|
24
|
+
|
25
|
+
# Release
|
26
|
+
- uses: rubygems/release-gem@v1
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Minitest::Data
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/y-yagi/minitest-data.svg?branch=master)](https://travis-ci.org/y-yagi/minitest-data)
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/minitest-data.svg)](http://badge.fury.io/rb/minitest-data)
|
5
4
|
|
6
5
|
`Minitest::Data` provides Data-Driven-Test functionality to minitest/test.
|
@@ -39,16 +38,15 @@ end
|
|
39
38
|
You can also specify block for the `data` method.
|
40
39
|
|
41
40
|
```ruby
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
41
|
+
data do
|
42
|
+
data_set = {}
|
43
|
+
data_set["empty string"] = [true, ""]
|
44
|
+
data_set["plain string"] = [false, "hello"]
|
45
|
+
data_set
|
46
|
+
end
|
47
|
+
def test_empty(data)
|
48
|
+
expected, target = data
|
49
|
+
assert_equal(expected, target.empty?)
|
52
50
|
end
|
53
51
|
```
|
54
52
|
|
@@ -61,7 +59,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
61
59
|
|
62
60
|
## Contributing
|
63
61
|
|
64
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/y-yagi/minitest-data. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
65
63
|
|
66
64
|
|
67
65
|
## License
|
data/lib/minitest/data.rb
CHANGED
@@ -62,35 +62,28 @@ module Minitest
|
|
62
62
|
|
63
63
|
attr_accessor :data_label, :data_attribute
|
64
64
|
|
65
|
-
def location
|
66
|
-
label_string = ""
|
67
|
-
label_string = "(#{self.data_label})" if self.data_label
|
68
|
-
loc = " [#{self.failure.location}]" unless passed? or error?
|
69
|
-
"#{self.class}##{self.name}#{label_string}#{loc}"
|
70
|
-
end
|
71
|
-
|
72
65
|
def run
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
time_it do
|
67
|
+
capture_exceptions do
|
68
|
+
Minitest::Test::SETUP_METHODS.each do |hook|
|
69
|
+
self.send hook
|
70
|
+
end
|
77
71
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
72
|
+
if data_attribute
|
73
|
+
self.send self.name, data_attribute
|
74
|
+
else
|
75
|
+
self.send self.name
|
83
76
|
end
|
77
|
+
end
|
84
78
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
79
|
+
Minitest::Test::TEARDOWN_METHODS.each do |hook|
|
80
|
+
capture_exceptions do
|
81
|
+
self.send hook
|
89
82
|
end
|
90
83
|
end
|
91
84
|
end
|
92
85
|
|
93
|
-
self
|
86
|
+
Minitest::Result.from self
|
94
87
|
end
|
95
88
|
end
|
96
89
|
|
@@ -111,15 +104,43 @@ module Minitest
|
|
111
104
|
test_klass.data_attribute = value
|
112
105
|
|
113
106
|
result = test_klass.run
|
114
|
-
raise "#{klass}#run _must_ return self" unless
|
107
|
+
raise "#{klass}#run _must_ return self" unless Minitest::Result === result
|
115
108
|
result
|
116
109
|
else
|
117
110
|
super(klass, method_name)
|
118
111
|
end
|
119
112
|
end
|
120
113
|
end
|
114
|
+
|
115
|
+
module Result
|
116
|
+
attr_accessor :data_label
|
117
|
+
|
118
|
+
class << self
|
119
|
+
def prepended(klass)
|
120
|
+
class << klass
|
121
|
+
prepend ClassMethods
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
module ClassMethods
|
127
|
+
def from(runnable)
|
128
|
+
r = super
|
129
|
+
r.data_label = runnable.data_label if defined?(runnable.data_label)
|
130
|
+
r
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def location
|
135
|
+
label_string = ""
|
136
|
+
label_string = "(#{self.data_label})" if self.data_label
|
137
|
+
loc = " [#{self.failure.location.delete_prefix Minitest::Reportable::BASE_DIR}]" unless passed? or error?
|
138
|
+
"#{self.class}##{self.name}#{label_string}#{loc}"
|
139
|
+
end
|
140
|
+
end
|
121
141
|
end
|
122
142
|
end
|
123
143
|
|
124
144
|
Minitest::Test.prepend(Minitest::Data::Test)
|
145
|
+
Minitest::Result.prepend(Minitest::Data::Result)
|
125
146
|
Minitest.prepend(Minitest::Data)
|
data/minitest-data.gemspec
CHANGED
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "minitest", "
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "minitest", ">= 5.25.1"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "byebug"
|
27
|
+
|
28
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
27
29
|
end
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.25.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.25.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '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: '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: '0'
|
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: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,8 +73,9 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/ci.yml"
|
77
|
+
- ".github/workflows/gem_push.yml"
|
76
78
|
- ".gitignore"
|
77
|
-
- ".travis.yml"
|
78
79
|
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
@@ -88,7 +89,8 @@ files:
|
|
88
89
|
homepage: https://github.com/y-yagi/minitest-data
|
89
90
|
licenses:
|
90
91
|
- MIT
|
91
|
-
metadata:
|
92
|
+
metadata:
|
93
|
+
rubygems_mfa_required: 'true'
|
92
94
|
post_install_message:
|
93
95
|
rdoc_options: []
|
94
96
|
require_paths:
|
@@ -104,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
106
|
- !ruby/object:Gem::Version
|
105
107
|
version: '0'
|
106
108
|
requirements: []
|
107
|
-
|
108
|
-
rubygems_version: 2.6.12
|
109
|
+
rubygems_version: 3.5.16
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Provides Data-Driven-Test functionality to minitest/test.
|