rspec-paramz 1.2.0 → 3.0.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: 13b0814bc75385484cc98d0e177265f3946afc2f85ebfa9cc7b074396723cb36
4
- data.tar.gz: ca7a49c75162ca57d76296a7de15d8d222d92a66451637fa41f5032f3c08c602
3
+ metadata.gz: dc07d56d743753a5fb87a71f59a09aa0e16412baf21547a3fbaacf825c4d73fa
4
+ data.tar.gz: ad32309278e5f1039be6919fec42b4252f61125df84f71ca565f45be6ca1877e
5
5
  SHA512:
6
- metadata.gz: efc72c44e493d2010d21468eec25971a04931966f94a50e4fc61c20045d25a85d9cfb189b71716833e909b2b38e8be4816df8b40e669b8b4cbb7c6c1d76d00cb
7
- data.tar.gz: d3e7ddc26c2649fe090e9e36a7924a090fdc6178af4252a6207de64e01321ac1683f02526dcb2048510df3f2ddf986b8b5af8a0e796d8b26a979decec1b5308b
6
+ metadata.gz: a5d40336ebd8d93cdf7dc5a3422ff1c989a35c39359a6f925ec9076ed8976e6bd94215becb5502524fd14d40eab7c842eadce051bf197c0e3fa2bfbd83fce144
7
+ data.tar.gz: cad59113cf11ebaca4bde86da66c79636496a9acccdac6f6f2913ab14ae488ea7a4e3cb1d527f59d5263ec1fe7c84af49fb02af8d2d1d7d5191f909c14f029c2
@@ -0,0 +1,26 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ test:
12
+
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ['3.3', '3.4', 'head']
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25
+ - name: Run tests
26
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ mise.toml
data/.rubocop.yml CHANGED
@@ -4,4 +4,4 @@ inherit_gem:
4
4
  - "config/rspec.yml"
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 3.3
data/Gemfile.lock CHANGED
@@ -1,67 +1,79 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-paramz (1.2.0)
5
- rspec (~> 3.0)
4
+ rspec-paramz (2.0.0)
5
+ prism
6
+ rspec
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- ast (2.4.2)
11
+ ast (2.4.3)
11
12
  coderay (1.1.3)
12
- diff-lcs (1.5.0)
13
- method_source (1.0.0)
13
+ diff-lcs (1.6.2)
14
+ json (2.13.2)
15
+ language_server-protocol (3.17.0.5)
16
+ lint_roller (1.1.0)
17
+ method_source (1.1.0)
14
18
  onkcop (1.0.0.0)
15
19
  rubocop (>= 0.80.0)
16
20
  rubocop-rspec (>= 1.34.0)
17
- parallel (1.22.1)
18
- parser (3.1.2.0)
21
+ parallel (1.27.0)
22
+ parser (3.3.9.0)
19
23
  ast (~> 2.4.1)
20
- pry (0.14.1)
24
+ racc
25
+ prism (1.4.0)
26
+ pry (0.15.2)
21
27
  coderay (~> 1.1)
22
28
  method_source (~> 1.0)
29
+ racc (1.8.1)
23
30
  rainbow (3.1.1)
24
- rake (13.0.6)
25
- regexp_parser (2.5.0)
26
- rexml (3.2.5)
27
- rspec (3.11.0)
28
- rspec-core (~> 3.11.0)
29
- rspec-expectations (~> 3.11.0)
30
- rspec-mocks (~> 3.11.0)
31
- rspec-core (3.11.0)
32
- rspec-support (~> 3.11.0)
33
- rspec-expectations (3.11.0)
31
+ rake (13.3.0)
32
+ regexp_parser (2.11.0)
33
+ rspec (3.13.1)
34
+ rspec-core (~> 3.13.0)
35
+ rspec-expectations (~> 3.13.0)
36
+ rspec-mocks (~> 3.13.0)
37
+ rspec-core (3.13.5)
38
+ rspec-support (~> 3.13.0)
39
+ rspec-expectations (3.13.5)
34
40
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.11.0)
36
- rspec-mocks (3.11.1)
41
+ rspec-support (~> 3.13.0)
42
+ rspec-mocks (3.13.5)
37
43
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.11.0)
39
- rspec-support (3.11.0)
40
- rubocop (1.30.1)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-support (3.13.4)
46
+ rubocop (1.79.2)
47
+ json (~> 2.3)
48
+ language_server-protocol (~> 3.17.0.2)
49
+ lint_roller (~> 1.1.0)
41
50
  parallel (~> 1.10)
42
- parser (>= 3.1.0.0)
51
+ parser (>= 3.3.0.2)
43
52
  rainbow (>= 2.2.2, < 4.0)
44
- regexp_parser (>= 1.8, < 3.0)
45
- rexml (>= 3.2.5, < 4.0)
46
- rubocop-ast (>= 1.18.0, < 2.0)
53
+ regexp_parser (>= 2.9.3, < 3.0)
54
+ rubocop-ast (>= 1.46.0, < 2.0)
47
55
  ruby-progressbar (~> 1.7)
48
- unicode-display_width (>= 1.4.0, < 3.0)
49
- rubocop-ast (1.18.0)
50
- parser (>= 3.1.1.0)
51
- rubocop-rspec (2.11.1)
52
- rubocop (~> 1.19)
53
- ruby-progressbar (1.11.0)
54
- unicode-display_width (2.1.0)
56
+ unicode-display_width (>= 2.4.0, < 4.0)
57
+ rubocop-ast (1.46.0)
58
+ parser (>= 3.3.7.2)
59
+ prism (~> 1.4)
60
+ rubocop-rspec (3.6.0)
61
+ lint_roller (~> 1.1)
62
+ rubocop (~> 1.72, >= 1.72.1)
63
+ ruby-progressbar (1.13.0)
64
+ unicode-display_width (3.1.4)
65
+ unicode-emoji (~> 4.0, >= 4.0.4)
66
+ unicode-emoji (4.0.4)
55
67
 
56
68
  PLATFORMS
57
69
  ruby
58
70
 
59
71
  DEPENDENCIES
60
- bundler (~> 2.0)
72
+ bundler
61
73
  onkcop
62
74
  pry
63
- rake (~> 13.0)
75
+ rake
64
76
  rspec-paramz!
65
77
 
66
78
  BUNDLED WITH
67
- 2.3.15
79
+ 2.7.1
data/README.md CHANGED
@@ -6,8 +6,7 @@ Inspired by [tomykaira/rspec-parameterized](https://github.com/tomykaira/rspec-p
6
6
 
7
7
  ## Requirements
8
8
 
9
- - Ruby 2.6 or later
10
- - This gem uses `RubyVM::AbstractSyntaxTree`
9
+ - Ruby 3.3 or later
11
10
 
12
11
  ## Installation
13
12
 
@@ -31,236 +30,37 @@ See [paramz_spec.rb](https://github.com/fukayatsu/rspec-paramz/blob/master/spec/
31
30
 
32
31
  ```ruby
33
32
  RSpec.describe RSpec::Paramz do
34
- describe '#paramz' do
35
- context 'format 1' do
33
+ describe "#paramz" do
34
+ describe "additions" do
35
+ let(:one) { 1 }
36
+ let(:two) { 2 }
37
+ let(:three) { 3 }
36
38
  paramz(
37
- [:a, :b, :answer],
38
- 1, 2, 3,
39
- 3, 8, 11,
40
- 5, -8, -3,
39
+ -> { [:a, :b, :answer] },
40
+ -> { [one, two, three ] },
41
+ -> { [3, 8, 11 ] },
42
+ -> { [5, -8, -3 ] },
41
43
  ) do
42
- it 'should do additions' do
44
+ it "do additions" do
43
45
  expect(a + b).to eq answer
44
46
  end
45
47
  end
46
-
47
- #=>
48
- # [a = 1 | b = 2 | answer = 3]
49
- # should do additions
50
- # [a = 3 | b = 8 | answer = 11]
51
- # should do additions
52
- # [a = 5 | b = -8 | answer = -3]
53
- # should do additions
54
- end
55
-
56
- context 'format 2' do
57
- paramz(
58
- [:a, :b, subject: -> { a + b }],
59
- 1, 2, 3,
60
- 3, 8, 11,
61
- 5, -8, -3,
62
- )
63
-
64
- #=>
65
- # [a = 1 | b = 2 | subject { a + b } = 3]
66
- # should == 3
67
- # [a = 3 | b = 8 | subject { a + b } = 11]
68
- # should == 11
69
- # [a = 5 | b = -8 | subject { a + b } = -3]
70
- # should == -3
71
- end
72
-
73
- context 'format 2-a' do
74
- paramz(
75
- [:a, :b, subject: -> { a + b }],
76
- 1, 2, 3,
77
- 3, 8, 11,
78
- 5, -8, -3,
79
- ) do
80
- it 'should do additions' do
81
- expect(subject).to eq(a + b)
82
- end
83
- end
84
-
85
- #=>
86
- # [a = 1 | b = 2 | subject { a + b } = 3]
87
- # should do additions
88
- # [a = 3 | b = 8 | subject { a + b } = 11]
89
- # should do additions
90
- # [a = 5 | b = -8 | subject { a + b } = -3]
91
- # should do additions
92
- end
93
-
94
- context 'format 3' do
95
- paramz(
96
- [:a, :b, subject: { answer: -> { a + b } }],
97
- 1, 2, 3,
98
- 3, 8, 11,
99
- 5, -8, -3,
100
- )
101
-
102
- #=>
103
- # [a = 1 | b = 2 | subject(:answer) { a + b } = 3]
104
- # should == 3
105
- # [a = 3 | b = 8 | subject(:answer) { a + b } = 11]
106
- # should == 11
107
- # [a = 5 | b = -8 | subject(:answer) { a + b } = -3]
108
- # should == -3
109
- end
110
-
111
- context 'format 3-b' do
112
- paramz(
113
- [:a, :b, subject: { answer: -> { a + b } }],
114
- 1, 2, 3,
115
- 3, 8, 11,
116
- 5, -8, -3,
117
- ) do
118
- it 'should do additions' do
119
- expect(subject).to eq(a + b)
120
- end
121
-
122
- it 'should do additions' do
123
- expect(answer).to eq(a + b)
124
- end
125
- end
126
-
127
- #=>
128
- # [a = 1 | b = 2 | subject(:answer) { a + b } = 3]
129
- # should do additions
130
- # should do additions
131
- # [a = 3 | b = 8 | subject(:answer) { a + b } = 11]
132
- # should do additions
133
- # should do additions
134
- # [a = 5 | b = -8 | subject(:answer) { a + b } = -3]
135
- # should do additions
136
- # should do additions
137
- end
138
-
139
- context 'format 4' do
140
- subject { a + b }
141
-
142
- paramz(
143
- [:a, :b, :subject],
144
- 1, 2, 3,
145
- 0, 0, 0,
146
- -1, -2, -3,
147
- )
148
-
149
- #=>
150
- # [a = 1 | b = 2 | subject = 3]
151
- # should == 3
152
- # [a = 0 | b = 0 | subject = 0]
153
- # should == 0
154
- # [a = -1 | b = -2 | subject = -3]
155
- # should == -3
156
- end
157
-
158
- context 'rspec-let' do
159
- let(:one) { 1 }
160
- let(:two) { one * 2 }
161
- let(:three) { one * 3 }
162
-
163
- context 'default' do
164
- paramz(
165
- [:a, :b, :answer],
166
- -> { one }, 0, 1,
167
- -> { one }, -> { one }, -> { 2 },
168
- -> { one }, -> { two }, -> { three },
169
- ) do
170
- it 'should do additions' do
171
- expect(a + b).to eq answer
172
- end
173
- end
174
-
175
- #=>
176
- # [a = { one } | b = 0 | answer = 1]
177
- # should do additions
178
- # [a = { one } | b = { one } | answer = { 2 }]
179
- # should do additions
180
- # [a = { one } | b = { two } | answer = { three }]
181
- # should do additions
182
- end
183
-
184
- context 'default 2' do
185
- subject { a + b }
186
- paramz(
187
- [:a, :b, :subject],
188
- -> { one }, 0, 1,
189
- -> { one }, -> { one }, -> { 2 },
190
- -> { one }, -> { two }, -> { three },
191
- )
192
-
193
- #=>
194
- # [a = { one } | b = 0 | subject = 1]
195
- # should == 1
196
- # [a = { one } | b = { one } | subject = { 2 }]
197
- # should == 2
198
- # [a = { one } | b = { two } | subject = { three }]
199
- # should == 3
200
- end
201
-
202
- context 'default 3' do
203
- paramz(
204
- [:a, :b, subject: -> { a + b }],
205
- -> { one }, 0, 1,
206
- -> { one }, -> { one }, -> { 2 },
207
- -> { one }, -> { two }, -> { three },
208
- )
209
-
210
- #=>
211
- # [a = { one } | b = 0 | subject { a + b } = 1]
212
- # should == 1
213
- # [a = { one } | b = { one } | subject { a + b } = { 2 }]
214
- # should == 2
215
- # [a = { one } | b = { two } | subject { a + b } = { three }]
216
- # should == 3
217
- end
218
-
219
- context 'using RSpec::Paramz::Syntax' do
220
- using RSpec::Paramz::Syntax
221
- paramz(
222
- [:a, :b, :answer],
223
- :one.&, 0, 1,
224
- :one.&, :one.&, -> { 2 },
225
- :one.&, :two.&, :three.&,
226
- ) do
227
- it 'should do additions' do
228
- expect(a + b).to eq answer
229
- end
230
- end
231
-
232
- #=>
233
- # [a = { one } | b = 0 | answer = 1]
234
- # should do additions
235
- # [a = { one } | b = { one } | answer = { 2 }]
236
- # should do additions
237
- # [a = { one } | b = { two } | answer = { three }]
238
- # should do additions
239
- end
240
- end
241
-
242
- context 'nil or empty' do
243
- paramz(
244
- [:a, :b, :answer],
245
- "foo", nil, "foo",
246
- "", nil, "",
247
- nil, "bar", nil
248
- ) do
249
- it 'should do additions' do
250
- expect(a&.to_s).to eq answer
251
- end
252
- end
253
-
254
- #=>
255
- # [a = "foo" | b = nil | answer = "foo"]
256
- # should do additions
257
- # [a = "" | b = nil | answer = ""]
258
- # should do additions
259
- # [a = nil | b = "bar" | answer = nil]
260
- # should do additions
261
48
  end
262
49
  end
263
50
  end
51
+
52
+ # =>
53
+ # RSpec::Paramz
54
+ # #paramz
55
+ # additions
56
+ # [a = one | b = two | answer = three]
57
+ # do additions
58
+ # [a = 3 | b = 8 | answer = 11]
59
+ # do additions
60
+ # [a = 5 | b = -8 | answer = -3]
61
+ # do additions
62
+ # [a = "a" | b = "b" | answer = "ab"]
63
+ # do additions
264
64
  ```
265
65
 
266
66
  ## Development
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Paramz
3
- VERSION = "1.2.0"
3
+ VERSION = "3.0.0".freeze
4
4
  end
5
5
  end
data/lib/rspec/paramz.rb CHANGED
@@ -1,51 +1,78 @@
1
1
  require "rspec/paramz/version"
2
- require "rspec/paramz/syntax"
3
- require "rspec/paramz/named_proc"
4
- require "rspec/paramz/pretty_print"
2
+ require "prism"
3
+
4
+ class Lambda < Prism::Visitor
5
+ attr_reader :calls
6
+
7
+ def initialize(calls)
8
+ @calls = calls
9
+ end
10
+
11
+ def visit_lambda_node(node)
12
+ super(node)
13
+ @calls << node.source
14
+ end
15
+ end
5
16
 
6
17
  module RSpec
7
18
  module Paramz
8
19
  module ExampleGroupMethods
9
20
  def paramz(*args, &block)
10
- labels = args.first
11
-
12
- if !block_given? && !labels.any? { |label| subject_label?(label) }
13
- raise ArgumentError, "No block or subject given to paramz."
21
+ unless block_given?
22
+ raise ArgumentError, "No block given to paramz."
14
23
  end
15
24
 
16
- args[1..-1].each_slice(labels.length).with_index do |arg, index|
17
- pairs = [labels, arg].transpose.to_h
18
-
19
- context_name = '[' + pairs.map { |k, v| "#{RSpec::Paramz::PrettyPrint.inspect(k)} = #{RSpec::Paramz::PrettyPrint.inspect(v, false)}" }.join(' | ') + ']'
20
-
21
- context context_name do
22
- pairs.each do |label, val|
23
- if subject_label?(label)
24
- if label == :subject
25
- module_exec { val.is_a?(Proc) ? let(:_paramz_subject, &val) : let(:_paramz_subject) { val } }
26
- it { should == _paramz_subject }
27
- next
28
- end
29
-
30
- _subject, _subject_name = parse_subject(label)
31
-
32
- module_exec { _subject.is_a?(Proc) ? subject(_subject_name, &_subject) : subject(_subject_name) { _subject } }
25
+ labels = args.first
26
+ labels = labels.call if labels.respond_to?(:call)
27
+ args[1..].each do |arg|
28
+ location = arg.source_location
29
+ source = spec_file_content(location.first).each_line.to_a[location[1] - 1].strip.delete_suffix(",")
30
+ result = Prism.parse(source)
31
+ lambda_node = result.value.compact_child_nodes.first.compact_child_nodes.first
32
+ array_nodes = lambda_node.body.compact_child_nodes.first
33
+ nodes = array_nodes.elements
34
+
35
+ texts = nodes.map do |node|
36
+ range = node.location.start_offset...node.location.end_offset
37
+ source.byteslice(range)
38
+ end
33
39
 
34
- unless block_given?
35
- module_exec { val.is_a?(Proc) ? let(:_paramz_subject, &val) : let(:_paramz_subject) { val } }
36
- it { should == _paramz_subject }
40
+ context_name =
41
+ "[#{[labels, texts].transpose.map {|label, text| "#{label} = #{text}" }.join(" | ")}]"
42
+
43
+ context(context_name) do
44
+ nodes.each.with_index do |node, index|
45
+ let(labels[index]) do
46
+ if node.type == :true_node
47
+ true
48
+ elsif node.type == :false_node
49
+ false
50
+ elsif node.type == :nil_node
51
+ nil
52
+ elsif node.type == :symbol_node
53
+ node.value.to_sym
54
+ elsif node.type == :string_node
55
+ node.unescaped
56
+ elsif node.type == :array_node
57
+ range = node.opening_loc.start_offset...node.closing_loc.end_offset
58
+ eval(source.byteslice(range)) # rubocop:disable Security/Eval
59
+ elsif node.respond_to?(:value)
60
+ node.value
61
+ elsif node.respond_to?(:content)
62
+ node.content
63
+ else
64
+ loc = node.location
65
+ eval(source[loc.start_character_offset...loc.end_code_units_offset]) # rubocop:disable Security/Eval
37
66
  end
38
- else
39
- module_exec { val.is_a?(Proc) ? let(label, &val) : let(label) { val } }
40
67
  end
41
68
  end
42
69
 
43
- module_eval(&block) if block_given?
70
+ module_exec(&block)
44
71
 
45
72
  after(:each) do |example|
46
73
  if example.exception
47
- index_info = arg.map { |v| RSpec::Paramz::PrettyPrint.inspect(v, false) }.join(', ')
48
- example.exception.backtrace.push("failed paramz index is:#{index + 1}:[#{index_info}]")
74
+ location = arg.source_location
75
+ example.exception.backtrace.push("failed paramz: #{location.first}:#{location.last}")
49
76
  end
50
77
  end
51
78
  end
@@ -54,22 +81,10 @@ module RSpec
54
81
 
55
82
  private
56
83
 
57
- def subject_label?(label)
58
- return true if label == :subject
59
- label.is_a?(Hash) && label.keys == [:subject]
60
- end
61
-
62
- def parse_subject(label)
63
- _subject = label[:subject]
64
-
65
- _subject_name = nil
66
- if _subject.is_a?(Hash)
67
- _subject_name = _subject.keys.first
68
- _subject = _subject.values.first
84
+ def spec_file_content(path)
85
+ @spec_file_content ||= {}
86
+ @spec_file_content[path] ||= File.read(path)
69
87
  end
70
-
71
- [_subject, _subject_name]
72
- end
73
88
  end
74
89
  end
75
90
 
data/rspec-paramz.gemspec CHANGED
@@ -8,8 +8,10 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["fukayatsu"]
9
9
  spec.email = ["fukayatsu@gmail.com"]
10
10
 
11
- spec.summary = %q{Simple Parameterized Test for RSpec.}
12
- spec.description = %q{Simple Parameterized Test for RSpec}
11
+ spec.required_ruby_version = ">= 3.3.0"
12
+
13
+ spec.summary = "Simple Parameterized Test for RSpec."
14
+ spec.description = "Simple Parameterized Test for RSpec"
13
15
  spec.homepage = "https://github.com/fukayatsu/rspec-paramz"
14
16
  spec.license = "MIT"
15
17
 
@@ -19,17 +21,18 @@ Gem::Specification.new do |spec|
19
21
 
20
22
  # Specify which files should be added to the gem when it is released.
21
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
24
26
  end
25
27
  spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
27
29
  spec.require_paths = ["lib"]
28
30
 
29
- spec.add_runtime_dependency "rspec", "~> 3.0"
31
+ spec.add_runtime_dependency "prism"
32
+ spec.add_runtime_dependency "rspec"
30
33
 
31
- spec.add_development_dependency "bundler", "~> 2.0"
32
- spec.add_development_dependency "rake", "~> 13.0"
34
+ spec.add_development_dependency "bundler"
33
35
  spec.add_development_dependency "onkcop"
34
36
  spec.add_development_dependency "pry"
37
+ spec.add_development_dependency "rake"
35
38
  end
metadata CHANGED
@@ -1,59 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-paramz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-15 00:00:00.000000000 Z
11
+ date: 2025-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prism
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - "~>"
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: '3.0'
33
+ version: '0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - "~>"
38
+ - - ">="
25
39
  - !ruby/object:Gem::Version
26
- version: '3.0'
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "~>"
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '2.0'
47
+ version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "~>"
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '2.0'
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: rake
56
+ name: onkcop
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: '13.0'
61
+ version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '13.0'
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: onkcop
70
+ name: pry
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: pry
84
+ name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -87,10 +101,10 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
104
+ - ".github/workflows/test.yml"
90
105
  - ".gitignore"
91
106
  - ".rspec"
92
107
  - ".rubocop.yml"
93
- - ".travis.yml"
94
108
  - CODE_OF_CONDUCT.md
95
109
  - Gemfile
96
110
  - Gemfile.lock
@@ -101,9 +115,6 @@ files:
101
115
  - bin/console
102
116
  - bin/setup
103
117
  - lib/rspec/paramz.rb
104
- - lib/rspec/paramz/named_proc.rb
105
- - lib/rspec/paramz/pretty_print.rb
106
- - lib/rspec/paramz/syntax.rb
107
118
  - lib/rspec/paramz/version.rb
108
119
  - rspec-paramz.gemspec
109
120
  homepage: https://github.com/fukayatsu/rspec-paramz
@@ -121,14 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
132
  requirements:
122
133
  - - ">="
123
134
  - !ruby/object:Gem::Version
124
- version: '0'
135
+ version: 3.3.0
125
136
  required_rubygems_version: !ruby/object:Gem::Requirement
126
137
  requirements:
127
138
  - - ">="
128
139
  - !ruby/object:Gem::Version
129
140
  version: '0'
130
141
  requirements: []
131
- rubygems_version: 3.2.33
142
+ rubygems_version: 3.3.7
132
143
  signing_key:
133
144
  specification_version: 4
134
145
  summary: Simple Parameterized Test for RSpec.
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
@@ -1,16 +0,0 @@
1
- module RSpec
2
- module Paramz
3
- class NamedProc < Proc
4
- def initialize(name, &block)
5
- @name = name
6
- super(&block)
7
- end
8
-
9
- def to_s
10
- "{ #{@name} }"
11
- end
12
-
13
- alias_method :inspect, :to_s
14
- end
15
- end
16
- end
@@ -1,52 +0,0 @@
1
- module RSpec
2
- module Paramz
3
- module PrettyPrint
4
- def self.inspect(value, raw_value = true)
5
- case value
6
- when Hash
7
- subject(value)
8
- when Proc
9
- to_source(value)
10
- else
11
- raw_value ? value : value.inspect
12
- end
13
- end
14
-
15
- def self.subject(value)
16
- return value if value.keys != [:subject]
17
-
18
- _subject = value.values.first
19
- case _subject
20
- when Proc
21
- "subject #{to_source(_subject)}"
22
- when Hash
23
- subject_name = _subject.keys.first
24
- subject_value = _subject.values.first
25
-
26
- case subject_value
27
- when Proc
28
- "subject(:#{subject_name}) #{to_source(subject_value)}"
29
- else
30
- "subject { #{subject_value} }"
31
- end
32
- else
33
- value
34
- end
35
- end
36
-
37
- def self.to_source(value)
38
- return value if value.is_a?(NamedProc) || !value.is_a?(Proc)
39
-
40
- node = RubyVM::AbstractSyntaxTree.of(value)
41
- return value if node.nil?
42
-
43
- path = value.source_location.first
44
- lines = File.readlines(path)
45
- source_lines = lines[(node.first_lineno - 1)..(node.last_lineno - 1)]
46
- source_lines[-1] = source_lines[-1][0..(node.last_column - 1)]
47
- source_lines[0] = source_lines[0][node.first_column..]
48
- source_lines.map(&:strip).join("\n")
49
- end
50
- end
51
- end
52
- end
@@ -1,12 +0,0 @@
1
- module RSpec
2
- module Paramz
3
- module Syntax
4
- refine Symbol do
5
- def &
6
- _self = self
7
- NamedProc.new(self) { __send__(_self) }
8
- end
9
- end
10
- end
11
- end
12
- end