rspec-parameterized-core 1.0.0.beta1 → 1.0.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: c8154f0d17983d93033899679942929337ebc2fbfffea858f1d6d9696dfb24fd
4
- data.tar.gz: e4d2f7c5632141c43855df2a9010f44dd157adc963bf5def65ac98517447a81c
3
+ metadata.gz: bcd48d2b87de4ab47865a511551e78b1fb33bd5b4da4ebc25fce4950e3232558
4
+ data.tar.gz: 17ad0d1379f447197b946f943dc652ac32057ea6102169c5140f4b923cf6176c
5
5
  SHA512:
6
- metadata.gz: ff1e240ac4458d5dfe73d7b3a2f6573a4a0f06aeedc6abab0f4c0389769b7b71a210e93a5fbb8d8bfbc2f6510dcd4cd740abfae03be983920f656aafcdb1741f
7
- data.tar.gz: d02178da387a6471bd261770a3724e0158eeae210fff51b4b1fe44093d892e3700112d765a94711299974d9156fb5eb0e46aa5969f833030c831e96f75941c9c
6
+ metadata.gz: aa5444577be8a967b158b71a1dfb15cdb2af3b90b4b2b1cac79af5217960e319a31fec27b771b69d9a0f03660d31f787e8bb79b947753b8c63e79773cf8a97b9
7
+ data.tar.gz: 43807fad9790a182c1ed242a8896617b529bb70333ae8cf06ba1a798b605554a20fcdefb3fd4a2ef3c94742a1bd8b833b703987f2b580454848d84900ed16dd0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2022-12-31
4
-
5
- - Initial release
3
+ ## [1.0.0] - 2022-12-31
4
+ - https://github.com/tomykaira/rspec-parameterized/blob/master/CHANGELOG.md#v100-2022-12-31
5
+ - Drop support Ruby < 2.6 (explicitly)
data/Gemfile CHANGED
@@ -4,9 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in rspec-parameterized-core.gemspec
6
6
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.21"
data/README.md CHANGED
@@ -1,24 +1,179 @@
1
1
  # Rspec::Parameterized::Core
2
+ `rspec-parameterized-core` provides parameterized test syntax in [rspec](https://rspec.info/).
2
3
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rspec/parameterized/core`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+ [![Gem Version](https://badge.fury.io/rb/rspec-parameterized-core.svg)](https://badge.fury.io/rb/rspec-parameterized-core)
5
+ [![RSpec](https://github.com/rspec-parameterized/rspec-parameterized-core/actions/workflows/rspec.yml/badge.svg)](https://github.com/rspec-parameterized/rspec-parameterized-core/actions/workflows/rspec.yml)
6
6
 
7
7
  ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
8
+ ```ruby
9
+ # Install all components
10
+ group :test do
11
+ gem "rspec-parameterized", ">= 1.0.0"
12
+ end
13
+
14
+ # Install only rspec-parameterized-core
15
+ group :test do
16
+ gem "rspec-parameterized-core", ">= 1.0.0"
17
+ end
18
+ ```
18
19
 
19
20
  ## Usage
20
-
21
- TODO: Write usage instructions here
21
+ ### Nested Array Style
22
+ ```ruby
23
+ describe "plus" do
24
+ where(:a, :b, :answer) do
25
+ [
26
+ [1 , 2 , 3],
27
+ [5 , 8 , 13],
28
+ [0 , 0 , 0]
29
+ ]
30
+ end
31
+ with_them do
32
+ it "should do additions" do
33
+ expect(a + b).to eq answer
34
+ end
35
+ end
36
+ with_them do
37
+ # Can browse parameters via `params` method in with_them block
38
+ # Can browse all parameters via `all_params` method in with_them block
39
+ it "#{params[:a]} + #{params[:b]} == #{params[:answer]}" do
40
+ expect(a + b).to eq answer
41
+ end
42
+ end
43
+ end
44
+ ```
45
+
46
+ ### Hash and Array Style
47
+ ```ruby
48
+ # Given parameters is each value combinations
49
+ # On this case
50
+ # [
51
+ # [1, 5, 2],
52
+ # [1, 5, 4],
53
+ # [1, 7, 2],
54
+ # [1, 7, 4],
55
+ # [1, 9, 2],
56
+ # [1, 9, 4],
57
+ # [3, 5, 2],
58
+ # [3, 5, 4],
59
+ # [3, 7, 2],
60
+ # [3, 7, 4],
61
+ # [3, 9, 2],
62
+ # [3, 9, 4]
63
+ # ]
64
+ describe "Hash arguments" do
65
+ where(a: [1, 3], b: [5, 7, 9], c: [2, 4])
66
+ with_them do
67
+ it "sums is even" do
68
+ expect(a + b + c).to be_even
69
+ end
70
+ end
71
+ end
72
+ ```
73
+
74
+ ### Verbose Syntax
75
+ ```ruby
76
+ # For complex inputs or if you just want to be super explicit
77
+ describe "Verbose syntax" do
78
+ where do
79
+ {
80
+ "positive integers" => {
81
+ a: 1,
82
+ b: 2,
83
+ answer: 3,
84
+ },
85
+ "negative_integers" => {
86
+ a: -1,
87
+ b: -2,
88
+ answer: -3,
89
+ },
90
+ "mixed_integers" => {
91
+ a: 3,
92
+ b: -3,
93
+ answer: 0,
94
+ },
95
+ }
96
+ end
97
+ with_them do
98
+ it "should do additions" do
99
+ expect(a + b).to eq answer
100
+ end
101
+ end
102
+ end
103
+ ```
104
+
105
+ ### Custom names
106
+ ```ruby
107
+ # It's also possible to override each combination name using magic variable :case_name
108
+ # Output:
109
+ # Custom names for regular syntax
110
+ # positive integers
111
+ # should do additions
112
+ # negative integers
113
+ # should do additions
114
+ # mixed integers
115
+ # should do additions
116
+ describe "Custom names for regular syntax" do
117
+ where(:case_name, :a, :b, :answer) do
118
+ [
119
+ ["positive integers", 6, 2, 8],
120
+ ["negative integers", -1, -2, -3],
121
+ [ "mixed integers", -5, 3, -2],
122
+ ]
123
+ end
124
+ with_them do
125
+ it "should do additions" do
126
+ expect(a + b).to eq answer
127
+ end
128
+ end
129
+ end
130
+ # Or :case_names lambda for hash syntax
131
+ # Output:
132
+ # Custom naming for hash syntax
133
+ # 1 + 5 + 2
134
+ # sum is even
135
+ # 1 + 5 + 4
136
+ # sum is even
137
+ # 1 + 7 + 2
138
+ # sum is even
139
+ # ...
140
+ describe "Custom naming for hash syntax" do
141
+ where(case_names: ->(a, b, c){"#{a} + #{b} + #{c}"}, a: [1, 3], b: [5, 7, 9], c: [2, 4])
142
+ with_them do
143
+ it "sum is even" do
144
+ expect(a + b + c).to be_even
145
+ end
146
+ end
147
+ end
148
+ ```
149
+
150
+ ### lazy and ref types
151
+ ```ruby
152
+ # Use ref(:symbol) to use let/let! defined variables in the where block
153
+ # Use lazy when you want to create let/let! variables after the where block
154
+ #
155
+ # Failures will be more readable in the future - https://github.com/tomykaira/rspec-parameterized/pull/65
156
+ describe "lazy and ref types" do
157
+ let(:one) { 1 }
158
+ let(:four) { 4 }
159
+ where(:a, :b, :result) do
160
+ [
161
+ [ref(:one), ref(:four), lazy { two + three }]
162
+ ]
163
+ end
164
+ with_them do
165
+ context "use let after where block" do
166
+ let(:two) { 2 }
167
+ let(:three) { 3 }
168
+ it 'should equal 5' do
169
+ expect(a + b).to eq result
170
+ end
171
+ end
172
+ end
173
+ end
174
+ ```
175
+
176
+ I was inspired by [udzura's mock](https://gist.github.com/1881139).
22
177
 
23
178
  ## Development
24
179
 
@@ -28,7 +183,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
28
183
 
29
184
  ## Contributing
30
185
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rspec-parameterized-core.
186
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rspec-parameterized/rspec-parameterized-core.
32
187
 
33
188
  ## License
34
189
 
@@ -3,7 +3,7 @@
3
3
  module Rspec
4
4
  module Parameterized
5
5
  module Core
6
- VERSION = "1.0.0.beta1"
6
+ VERSION = "1.0.0"
7
7
  end
8
8
  end
9
9
  end
@@ -19,6 +19,7 @@ I was inspired by [udzura's mock](https://gist.github.com/1881139).}
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
20
  spec.metadata["source_code_uri"] = spec.homepage
21
21
  spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
22
+ spec.metadata["rubygems_mfa_required"] = "true"
22
23
 
23
24
  # Specify which files should be added to the gem when it is released.
24
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-parameterized-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
@@ -119,6 +119,7 @@ metadata:
119
119
  homepage_uri: https://github.com/rspec-parameterized/rspec-parameterized-core
120
120
  source_code_uri: https://github.com/rspec-parameterized/rspec-parameterized-core
121
121
  changelog_uri: https://github.com/rspec-parameterized/rspec-parameterized-core/blob/main/CHANGELOG.md
122
+ rubygems_mfa_required: 'true'
122
123
  post_install_message:
123
124
  rdoc_options: []
124
125
  require_paths:
@@ -130,9 +131,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
131
  version: 2.6.0
131
132
  required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  requirements:
133
- - - ">"
134
+ - - ">="
134
135
  - !ruby/object:Gem::Version
135
- version: 1.3.1
136
+ version: '0'
136
137
  requirements: []
137
138
  rubygems_version: 3.2.22
138
139
  signing_key: