rspec-paramz 1.0.0 → 1.1.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 +1 -1
- data/README.md +25 -1
- data/lib/rspec/paramz.rb +6 -0
- data/lib/rspec/paramz/version.rb +1 -1
- data/rspec-paramz.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 610d87ecec6b05b0743ff2c73eed111eb0fd01ef7f40cf4d74b655d06c4f9b40
|
4
|
+
data.tar.gz: c2aaedba4a6c9c6555ac250c14a0fdf35f9f00e8e83c2a776dc693547708ea0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f67a5721893964af719f8df816191b67fd92967c556af6d1e8c1e5f1cc62e53db90b3d7a1345b05f99623b68a176c9aa53adb24289f0c567c55145a033207fe
|
7
|
+
data.tar.gz: 1c040193b5b980f062ee9c8fa029badccbc12460bf16092c7a78acdd2f25825915d96248be45c144f5e087d7cd559d0b0b1ecdf4577346f88ea25f9eecc37131
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
# RSpec::Paramz [![Build Status](https://travis-ci.org/fukayatsu/rspec-paramz.svg?branch=master)](https://travis-ci.org/fukayatsu/rspec-paramz)
|
1
|
+
# RSpec::Paramz [![Gem Version](https://badge.fury.io/rb/rspec-paramz.svg)](https://badge.fury.io/rb/rspec-paramz) [![Build Status](https://travis-ci.org/fukayatsu/rspec-paramz.svg?branch=master)](https://travis-ci.org/fukayatsu/rspec-paramz)
|
2
2
|
|
3
3
|
Simple Parameterized Test for RSpec.
|
4
4
|
|
5
5
|
Inspired by [tomykaira/rspec-parameterized](https://github.com/tomykaira/rspec-parameterized).
|
6
6
|
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
- Ruby 2.6 or later
|
10
|
+
- This gem uses `RubyVM::AbstractSyntaxTree`
|
11
|
+
|
7
12
|
## Installation
|
8
13
|
|
9
14
|
Add this line to your application's Gemfile:
|
@@ -131,6 +136,25 @@ RSpec.describe RSpec::Paramz do
|
|
131
136
|
# should do additions
|
132
137
|
end
|
133
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
|
+
|
134
158
|
context 'rspec-let' do
|
135
159
|
let(:one) { 1 }
|
136
160
|
let(:two) { one * 2 }
|
data/lib/rspec/paramz.rb
CHANGED
@@ -21,6 +21,11 @@ module RSpec
|
|
21
21
|
context context_name do
|
22
22
|
pairs.each do |label, val|
|
23
23
|
if subject_label?(label)
|
24
|
+
if label == :subject
|
25
|
+
it { should == val }
|
26
|
+
next
|
27
|
+
end
|
28
|
+
|
24
29
|
_subject, _subject_name = parse_subject(label)
|
25
30
|
|
26
31
|
module_exec { _subject.is_a?(Proc) ? subject(_subject_name, &_subject) : subject(_subject_name) { _subject } }
|
@@ -45,6 +50,7 @@ module RSpec
|
|
45
50
|
private
|
46
51
|
|
47
52
|
def subject_label?(label)
|
53
|
+
return true if label == :subject
|
48
54
|
label.is_a?(Hash) && label.keys == [:subject]
|
49
55
|
end
|
50
56
|
|
data/lib/rspec/paramz/version.rb
CHANGED
data/rspec-paramz.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/fukayatsu/rspec-paramz"
|
18
|
-
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/fukayatsu/rspec-paramz/releases"
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -112,6 +112,7 @@ licenses:
|
|
112
112
|
metadata:
|
113
113
|
homepage_uri: https://github.com/fukayatsu/rspec-paramz
|
114
114
|
source_code_uri: https://github.com/fukayatsu/rspec-paramz
|
115
|
+
changelog_uri: https://github.com/fukayatsu/rspec-paramz/releases
|
115
116
|
post_install_message:
|
116
117
|
rdoc_options: []
|
117
118
|
require_paths:
|