rspec-paramz 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 610d87ecec6b05b0743ff2c73eed111eb0fd01ef7f40cf4d74b655d06c4f9b40
4
- data.tar.gz: c2aaedba4a6c9c6555ac250c14a0fdf35f9f00e8e83c2a776dc693547708ea0d
3
+ metadata.gz: 13b0814bc75385484cc98d0e177265f3946afc2f85ebfa9cc7b074396723cb36
4
+ data.tar.gz: ca7a49c75162ca57d76296a7de15d8d222d92a66451637fa41f5032f3c08c602
5
5
  SHA512:
6
- metadata.gz: 5f67a5721893964af719f8df816191b67fd92967c556af6d1e8c1e5f1cc62e53db90b3d7a1345b05f99623b68a176c9aa53adb24289f0c567c55145a033207fe
7
- data.tar.gz: 1c040193b5b980f062ee9c8fa029badccbc12460bf16092c7a78acdd2f25825915d96248be45c144f5e087d7cd559d0b0b1ecdf4577346f88ea25f9eecc37131
6
+ metadata.gz: efc72c44e493d2010d21468eec25971a04931966f94a50e4fc61c20045d25a85d9cfb189b71716833e909b2b38e8be4816df8b40e669b8b4cbb7c6c1d76d00cb
7
+ data.tar.gz: d3e7ddc26c2649fe090e9e36a7924a090fdc6178af4252a6207de64e01321ac1683f02526dcb2048510df3f2ddf986b8b5af8a0e796d8b26a979decec1b5308b
data/Gemfile.lock CHANGED
@@ -1,52 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-paramz (1.0.0)
4
+ rspec-paramz (1.2.0)
5
5
  rspec (~> 3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
11
- coderay (1.1.2)
12
- diff-lcs (1.3)
13
- jaro_winkler (1.5.3)
14
- method_source (0.9.2)
15
- onkcop (0.53.0.3)
16
- rubocop (>= 0.53.0)
17
- rubocop-rspec (>= 1.24.0)
18
- parallel (1.17.0)
19
- parser (2.6.3.0)
20
- ast (~> 2.4.0)
21
- pry (0.12.2)
22
- coderay (~> 1.1.0)
23
- method_source (~> 0.9.0)
24
- rainbow (3.0.0)
25
- rake (10.5.0)
26
- rspec (3.8.0)
27
- rspec-core (~> 3.8.0)
28
- rspec-expectations (~> 3.8.0)
29
- rspec-mocks (~> 3.8.0)
30
- rspec-core (3.8.2)
31
- rspec-support (~> 3.8.0)
32
- rspec-expectations (3.8.4)
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.5.0)
13
+ method_source (1.0.0)
14
+ onkcop (1.0.0.0)
15
+ rubocop (>= 0.80.0)
16
+ rubocop-rspec (>= 1.34.0)
17
+ parallel (1.22.1)
18
+ parser (3.1.2.0)
19
+ ast (~> 2.4.1)
20
+ pry (0.14.1)
21
+ coderay (~> 1.1)
22
+ method_source (~> 1.0)
23
+ 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)
33
34
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-mocks (3.8.1)
35
+ rspec-support (~> 3.11.0)
36
+ rspec-mocks (3.11.1)
36
37
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.8.0)
38
- rspec-support (3.8.2)
39
- rubocop (0.72.0)
40
- jaro_winkler (~> 1.5.1)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-support (3.11.0)
40
+ rubocop (1.30.1)
41
41
  parallel (~> 1.10)
42
- parser (>= 2.6)
42
+ parser (>= 3.1.0.0)
43
43
  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)
44
47
  ruby-progressbar (~> 1.7)
45
- unicode-display_width (>= 1.4.0, < 1.7)
46
- rubocop-rspec (1.33.0)
47
- rubocop (>= 0.60.0)
48
- ruby-progressbar (1.10.1)
49
- unicode-display_width (1.6.0)
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)
50
55
 
51
56
  PLATFORMS
52
57
  ruby
@@ -55,8 +60,8 @@ DEPENDENCIES
55
60
  bundler (~> 2.0)
56
61
  onkcop
57
62
  pry
58
- rake (~> 10.0)
63
+ rake (~> 13.0)
59
64
  rspec-paramz!
60
65
 
61
66
  BUNDLED WITH
62
- 2.0.2
67
+ 2.3.15
data/README.md CHANGED
@@ -181,6 +181,41 @@ RSpec.describe RSpec::Paramz do
181
181
  # should do additions
182
182
  end
183
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
+
184
219
  context 'using RSpec::Paramz::Syntax' do
185
220
  using RSpec::Paramz::Syntax
186
221
  paramz(
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Paramz
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
data/lib/rspec/paramz.rb CHANGED
@@ -22,14 +22,19 @@ module RSpec
22
22
  pairs.each do |label, val|
23
23
  if subject_label?(label)
24
24
  if label == :subject
25
- it { should == val }
25
+ module_exec { val.is_a?(Proc) ? let(:_paramz_subject, &val) : let(:_paramz_subject) { val } }
26
+ it { should == _paramz_subject }
26
27
  next
27
28
  end
28
29
 
29
30
  _subject, _subject_name = parse_subject(label)
30
31
 
31
32
  module_exec { _subject.is_a?(Proc) ? subject(_subject_name, &_subject) : subject(_subject_name) { _subject } }
32
- it { should == val } unless block_given?
33
+
34
+ unless block_given?
35
+ module_exec { val.is_a?(Proc) ? let(:_paramz_subject, &val) : let(:_paramz_subject) { val } }
36
+ it { should == _paramz_subject }
37
+ end
33
38
  else
34
39
  module_exec { val.is_a?(Proc) ? let(label, &val) : let(label) { val } }
35
40
  end
data/rspec-paramz.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "rspec", "~> 3.0"
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 2.0"
32
- spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "onkcop"
34
34
  spec.add_development_dependency "pry"
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-paramz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-08 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.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: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: onkcop
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +113,7 @@ metadata:
113
113
  homepage_uri: https://github.com/fukayatsu/rspec-paramz
114
114
  source_code_uri: https://github.com/fukayatsu/rspec-paramz
115
115
  changelog_uri: https://github.com/fukayatsu/rspec-paramz/releases
116
- post_install_message:
116
+ post_install_message:
117
117
  rdoc_options: []
118
118
  require_paths:
119
119
  - lib
@@ -128,8 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.0.3
132
- signing_key:
131
+ rubygems_version: 3.2.33
132
+ signing_key:
133
133
  specification_version: 4
134
134
  summary: Simple Parameterized Test for RSpec.
135
135
  test_files: []