rspec-parameterized-context 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d4108326dc810055c3cb625da061074ffc68cf5de7cbe7d18c9e06bbabcb4c6
|
4
|
+
data.tar.gz: 15471eee887a204ca7cbef3cf89f95c54f0cc4bf4d7b267be6f93b32a16cdeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 878ee943337a260faadbb945fa3fd9fcce4c0b5c738712cd8a7b48c75757600a8ad3cf850bb618c752730b0f66b4cd0ff3b2ea3a94abf3e263a3b3991cf7f5e0
|
7
|
+
data.tar.gz: '0125687003771403fb3ab4d3b137a0c89453f2ba43226da67c2d5d5da49d72690f75f6321025d253d4b9a1c5106e26c0bc7072fe54e7437d2770b2ce8931548c'
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Rspec::Parameterized::Context
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Generate interfaces like `RSpec::Parameterized` to support parameterized testing that is evaluated in transaction.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -12,28 +10,80 @@ Add this line to your application's Gemfile:
|
|
12
10
|
gem 'rspec-parameterized-context'
|
13
11
|
```
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle install
|
13
|
+
Then add this line to files under `spec/support/`
|
18
14
|
|
19
|
-
|
15
|
+
```ruby
|
16
|
+
require 'rspec_parameterized_context'
|
20
17
|
|
21
|
-
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.extend RSpecParameterizedContext
|
20
|
+
end
|
21
|
+
```
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### syntax
|
26
26
|
|
27
|
-
|
27
|
+
Provide interfaces like `RSpec::Parameterized`.
|
28
28
|
|
29
|
-
|
29
|
+
Pass `where` and `with_them` to `parameterized` method as one block and specify parameterized count as `size` keyword argument.
|
30
30
|
|
31
|
-
|
31
|
+
```ruby
|
32
|
+
describe "Addition" do
|
33
|
+
parameterized do
|
34
|
+
where(:a, :b, :answer, size: 3) do
|
35
|
+
[
|
36
|
+
[1 , 2 , 3],
|
37
|
+
[5 , 8 , 13],
|
38
|
+
[0 , 0 , 0]
|
39
|
+
]
|
40
|
+
end
|
41
|
+
|
42
|
+
with_them do
|
43
|
+
it do
|
44
|
+
expect(a + b).to eq answer
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
32
50
|
|
33
|
-
|
51
|
+
### feature
|
34
52
|
|
35
|
-
|
53
|
+
rspec-parameterized-context supports to evaluate block that given where method in transaction.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# Assume today is 2020/9/9
|
57
|
+
describe 'Evaluting block that given to where in transaction' do
|
58
|
+
let(:now) { Date.new(2020, 1, 1) }
|
59
|
+
# And travel to 2020/1/1
|
60
|
+
before { travel_to(now) }
|
61
|
+
|
62
|
+
parameterized do
|
63
|
+
where(:current_on, size: 1) do
|
64
|
+
[
|
65
|
+
[Date.current],
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
with_them do
|
70
|
+
it do
|
71
|
+
# current_on is evaluated as 2020/1/1
|
72
|
+
expect(current_on).to eq now
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
## Contributing
|
36
81
|
|
82
|
+
- Fork the project.
|
83
|
+
- Create feature branch.
|
84
|
+
- Commit and push.
|
85
|
+
- Make sure to add tests for it.
|
86
|
+
- Create pull request.
|
37
87
|
|
38
88
|
## License
|
39
89
|
|
@@ -51,8 +51,8 @@ module RSpecParameterizedContext
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def method_missing(action, *args, **options)
|
55
|
-
@rspec_context.send(action, *args, **options)
|
54
|
+
def method_missing(action, *args, **options, &block)
|
55
|
+
@rspec_context.send(action, *args, **options, &block)
|
56
56
|
end
|
57
57
|
|
58
58
|
def respond_to_missing?(action, include_private)
|
@@ -3,10 +3,10 @@ require_relative 'lib/rspec_parameterized_context/version'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "rspec-parameterized-context"
|
5
5
|
spec.version = RspecParameterizedContext::VERSION
|
6
|
-
spec.authors = ["alpaca-tc"]
|
7
|
-
spec.email = ["alpaca-tc@alpaca.tc"]
|
6
|
+
spec.authors = ["alpaca-tc", "kamillle"]
|
7
|
+
spec.email = ["alpaca-tc@alpaca.tc", "yuji.kmjm@gmail.com"]
|
8
8
|
|
9
|
-
spec.summary = %q{
|
9
|
+
spec.summary = %q{}
|
10
10
|
spec.description = %q{}
|
11
11
|
spec.homepage = "https://github.com/alpaca-tc/rspec-parameterized-context"
|
12
12
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-parameterized-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alpaca-tc
|
8
|
+
- kamillle
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
12
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: ''
|
14
15
|
email:
|
15
16
|
- alpaca-tc@alpaca.tc
|
17
|
+
- yuji.kmjm@gmail.com
|
16
18
|
executables: []
|
17
19
|
extensions: []
|
18
20
|
extra_rdoc_files: []
|
@@ -25,6 +27,7 @@ files:
|
|
25
27
|
- LICENSE.txt
|
26
28
|
- README.md
|
27
29
|
- Rakefile
|
30
|
+
- lib/rspec-parameterized-context.rb
|
28
31
|
- lib/rspec_parameterized_context.rb
|
29
32
|
- lib/rspec_parameterized_context/version.rb
|
30
33
|
- rspec-parameterized-context.gemspec
|
@@ -51,5 +54,5 @@ requirements: []
|
|
51
54
|
rubygems_version: 3.1.2
|
52
55
|
signing_key:
|
53
56
|
specification_version: 4
|
54
|
-
summary:
|
57
|
+
summary: ''
|
55
58
|
test_files: []
|