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 +4 -4
- data/Gemfile.lock +43 -38
- data/README.md +35 -0
- data/lib/rspec/paramz/version.rb +1 -1
- data/lib/rspec/paramz.rb +7 -2
- data/rspec-paramz.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b0814bc75385484cc98d0e177265f3946afc2f85ebfa9cc7b074396723cb36
|
4
|
+
data.tar.gz: ca7a49c75162ca57d76296a7de15d8d222d92a66451637fa41f5032f3c08c602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
11
|
-
coderay (1.1.
|
12
|
-
diff-lcs (1.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
rubocop (>=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
rspec-
|
29
|
-
rspec-
|
30
|
-
|
31
|
-
|
32
|
-
|
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.
|
35
|
-
rspec-mocks (3.
|
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.
|
38
|
-
rspec-support (3.
|
39
|
-
rubocop (
|
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 (>=
|
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, <
|
46
|
-
rubocop-
|
47
|
-
|
48
|
-
|
49
|
-
|
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 (~>
|
63
|
+
rake (~> 13.0)
|
59
64
|
rspec-paramz!
|
60
65
|
|
61
66
|
BUNDLED WITH
|
62
|
-
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(
|
data/lib/rspec/paramz/version.rb
CHANGED
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
|
-
|
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
|
-
|
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", "~>
|
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.
|
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:
|
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: '
|
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: '
|
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.
|
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: []
|