rspec-parameterized-context 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3e3e933899abf7804b78f52fe92f740546b8b7f6840851aaae5f6d2f4677c21
4
- data.tar.gz: 9116b63db19a1541cc2b707b78e044021788575236dfa1d6f5b4653426ba7c43
3
+ metadata.gz: 4d4108326dc810055c3cb625da061074ffc68cf5de7cbe7d18c9e06bbabcb4c6
4
+ data.tar.gz: 15471eee887a204ca7cbef3cf89f95c54f0cc4bf4d7b267be6f93b32a16cdeba
5
5
  SHA512:
6
- metadata.gz: 9699600126fa36bbb85560fd633917c7ac5b4af11fd3ed7b1c700476e209b425cfaee8c0c88d0be02c56734fa4ef7e1d9efd12c5b63fdea43565b141fbaef440
7
- data.tar.gz: 4902f4a26ababa625a8600ecad25ea0b19259343d4a5ff3a4858828945dec335a749cee82c636d35cbcd7d64eac4a3b0e4279c61613467d9b284827702ce6285
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
- 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/context`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- And then execute:
16
-
17
- $ bundle install
13
+ Then add this line to files under `spec/support/`
18
14
 
19
- Or install it yourself as:
15
+ ```ruby
16
+ require 'rspec_parameterized_context'
20
17
 
21
- $ gem install rspec-parameterized-context
18
+ RSpec.configure do |config|
19
+ config.extend RSpecParameterizedContext
20
+ end
21
+ ```
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ ### syntax
26
26
 
27
- ## Development
27
+ Provide interfaces like `RSpec::Parameterized`.
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ Pass `where` and `with_them` to `parameterized` method as one block and specify parameterized count as `size` keyword argument.
30
30
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- ## Contributing
51
+ ### feature
34
52
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rspec-parameterized-context. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rspec-parameterized-context/blob/master/CODE_OF_CONDUCT.md).
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
 
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec_parameterized_context'
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RspecParameterizedContext
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
@@ -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{RspecParameterizedContext supports simple parameterized test syntax in rspec.}
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.1
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-09 00:00:00.000000000 Z
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: RspecParameterizedContext supports simple parameterized test syntax in rspec.
57
+ summary: ''
55
58
  test_files: []