rspec-tabular 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +8 -1
- data/.travis.yml +18 -6
- data/CHANGELOG.md +8 -2
- data/CONTRIBUTING.md +24 -0
- data/CONTRIBUTOR_TERMS.md +40 -0
- data/README.md +20 -7
- data/lib/rspec/tabular/version.rb +1 -1
- data/lib/rspec/tabular/wrapped.rb +27 -0
- data/lib/rspec/tabular.rb +87 -58
- data/rspec-tabular.gemspec +3 -3
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7816f28cb971530c87ed3c3244fba37c9f61e0110af75d94c4006eaa5caae0c5
|
4
|
+
data.tar.gz: 84930991d5eeab5c78b348c00df499e8a3d0b1dc3e04ab5c9c10f3ca0a6d3685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792d663641679f27f7eb9fd44790da9df6037dd9c4fdf9b66ba141360a7aa4a3921279ddfcb88ca807e5f941724697c03d3cbd73f2ebc58b327d98938dafe0bc
|
7
|
+
data.tar.gz: 2b5b931e34e5e4e75b6ac1189c92891e78a89b6dc5b1db1356cd5b0509214c340478de5fcc3ccd2176b9991d16886f5859cf9e9ef7eb312cc24351e552497337
|
data/.rubocop.yml
CHANGED
@@ -4,11 +4,18 @@ Metrics/LineLength:
|
|
4
4
|
Max: 100
|
5
5
|
|
6
6
|
Metrics/MethodLength:
|
7
|
-
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
8
11
|
|
9
12
|
RSpec/EmptyExampleGroup:
|
10
13
|
Enabled: false
|
11
14
|
|
15
|
+
RSpec/ImplicitSubject:
|
16
|
+
Enabled: false
|
17
|
+
|
12
18
|
Metrics/BlockLength:
|
19
|
+
Max: 100
|
13
20
|
Exclude:
|
14
21
|
- spec/**/*
|
data/.travis.yml
CHANGED
@@ -1,20 +1,25 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2
|
5
|
-
- 2.3
|
6
|
-
- 2.4
|
7
3
|
- 2.5
|
4
|
+
- 2.6
|
5
|
+
- 2.7
|
8
6
|
- ruby-head
|
7
|
+
- jruby
|
9
8
|
matrix:
|
10
|
-
|
9
|
+
exclude:
|
10
|
+
- rvm: jruby
|
11
|
+
os: osx
|
11
12
|
- rvm: ruby-head
|
12
|
-
- rvm: 2.4
|
13
13
|
os: osx
|
14
|
+
allow_failures:
|
15
|
+
- rvm: ruby-head
|
16
|
+
- rvm: jruby
|
14
17
|
os:
|
15
18
|
- linux
|
16
19
|
- osx
|
17
20
|
sudo: false
|
21
|
+
cache:
|
22
|
+
bundler: true
|
18
23
|
before_script:
|
19
24
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter ; fi
|
20
25
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter ; fi
|
@@ -22,3 +27,10 @@ before_script:
|
|
22
27
|
- ./cc-test-reporter before-build
|
23
28
|
after_script:
|
24
29
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
30
|
+
|
31
|
+
# HACK: Continue to use bundler <2 because of Ruby v2.2 support. Once the
|
32
|
+
# lowest dependency is Ruby v2.3 we can consider upgrading to Bundler 2.x.
|
33
|
+
# @see https://docs.travis-ci.com/user/languages/ruby/#bundler-20
|
34
|
+
before_install:
|
35
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
36
|
+
- gem install bundler -v '< 2'
|
data/CHANGELOG.md
CHANGED
@@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
##
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.0.3] - 2022-01-24
|
10
|
+
### Added
|
11
|
+
- `with_context` to allow table inputs to be handle within the example context
|
12
|
+
|
13
|
+
## [0.0.2] - 2018-08-19
|
8
14
|
### Changed
|
9
15
|
- support checking Exception class and message in the same row
|
10
16
|
- catch exceptions when checking side effects, instead of raising the exception
|
11
17
|
|
12
|
-
## 0.0.1 - 2015-10-01
|
18
|
+
## [0.0.1] - 2015-10-01
|
13
19
|
### Added
|
14
20
|
- Everything! This is the initial release with a lot of basic functionality.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
To contribute,
|
4
|
+
|
5
|
+
1. Fork this repository.
|
6
|
+
1. Work on your changes within a topic branch.
|
7
|
+
1. Create a pull request
|
8
|
+
|
9
|
+
Pull requests are accepted under the discretion of the SidecarDevTools maintainer(s). Improve the chances your PR will be merged by following the requirements and guidelines below. For any questions, please e-mail developers@sugarcrm.com.
|
10
|
+
|
11
|
+
## REQUIREMENTS
|
12
|
+
|
13
|
+
* By creating a pull request, you are agreeing to [SugarCRM Open Source Contributor terms](CONTRIBUTOR_TERMS.md).
|
14
|
+
|
15
|
+
## GUIDELINES
|
16
|
+
|
17
|
+
* Make sure your pull contains quality code. We will certainly provide constructive feedback on works in progress but we will not merge incomplete pull requests.
|
18
|
+
* Make sure your pull is fully documented. For Javascript, we use jsdoc.
|
19
|
+
* Reference related Github Issues within commit comments and pull request comment where appropriate.
|
20
|
+
* Squash out minor or "typo" commits in your pull using `git commit -a` or `git rebase -i`.
|
21
|
+
|
22
|
+
## BUGS
|
23
|
+
|
24
|
+
File bugs or feature requests using Github Issue Tracker.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Contributor Terms (Version May 1, 2015)
|
2
|
+
|
3
|
+
Thank you for your interest in contributing to this SugarCRM Inc. (“SugarCRM”) open source project (the “Project”). By posting or submitting your ideas, code, documentation or other material to SugarCRM for this Project (“Your Contribution”), you agree to these Contributor Terms (these “Terms”). If you are an individual acting as a representative of a corporation or other legal entity making Your Contribution(s), then you represent and agree that you have the authority to accept these Terms on behalf of such corporation or other legal entity and all provisions of these Terms will bind that corporation or other legal entity as if it were named in these Terms in place of you.
|
4
|
+
|
5
|
+
## Voluntary Participation
|
6
|
+
|
7
|
+
You understand that Your Contributions are entirely voluntary and may expose Your Contributions to public display in a non-confidential manner. SugarCRM reserves the right (but has no obligation) to review, reject, use or modify Your Contributions.
|
8
|
+
|
9
|
+
## Ownership; License Back to You
|
10
|
+
|
11
|
+
In consideration for the potential inclusion or use of Your Contributions in SugarCRM products or services and the license back described in more detail below, you assign and agree to assign to SugarCRM all your rights, title, and interest worldwide in all intellectual property rights in Your Contributions, including all patents, copyrights and related moral rights (collectively, the “**Assigned IP Rights**”). SugarCRM has the right to record an assignment of the Assigned IP Rights from you to SugarCRM. If the Assigned IP Rights are not assignable by you for any reason, you agree to not to enforce, either directly or indirectly, and agree to waive any enforcement of the Assigned IP Rights against SugarCRM, its affiliates and any of its sublicensees or anyone in its sales or distribution channel.
|
12
|
+
|
13
|
+
SugarCRM grants a license back to you to use Your Contributions under the terms and conditions of the Apache License, version 2.0. This license is limited to Your Contributions only (as delivered to by you to SugarCRM) and does not provide any rights or grant to you any licenses in or to any other SugarCRM products or services or any modifications that SugarCRM may later make to Your Contributions. All rights not expressly granted in these Terms are reserved by SugarCRM.
|
14
|
+
|
15
|
+
## Responsibility for Your Contributions
|
16
|
+
|
17
|
+
You represent to SugarCRM that:
|
18
|
+
|
19
|
+
1. Each of Your Contributions are your original creation;
|
20
|
+
2. You have the legal right to assign ownership in Your Contributions to SugarCRM, as contemplated in these Terms or, if applicable, you have permission from your employer to make Your Contributions on behalf of that employer, that your employer has waived such rights for Your Contributions to SugarCRM;
|
21
|
+
3. You are legally entitled to assign the rights and waive enforcement of any rights you have, as contemplated in these Terms; and
|
22
|
+
4. To the best of your knowledge, Your Contributions do not and will not violate any third party’s intellectual property rights, including any patents, copyrights or related moral rights.
|
23
|
+
|
24
|
+
You agree to notify SugarCRM of any facts or circumstances of which you become aware that would make your representations in these Terms inaccurate in any manner.
|
25
|
+
|
26
|
+
If you wish to submit work that is not your original creation, you may submit it to SugarCRM separately from any of Your Contributions, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
|
27
|
+
|
28
|
+
## Disclaimers; Limitations of Liability
|
29
|
+
|
30
|
+
YOUR CONTRIBUTIONS AND SUGARCRM’S GRANT OF A LICENSE TO YOU FOR YOUR CONTRIBUTIONS ARE ALL PROVIDED TO THE OTHER PARTY ON AN “AS IS” BASIS AND WITHOUT ANY WARRANTY OF ANY KIND. EACH PARTY DISCLAIMS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
31
|
+
|
32
|
+
IN NO EVENT SHALL EITHER PARTY BE LIABLE TO THE OTHER PARTY FOR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL OR INDIRECT DAMAGES OF ANY KIND ARISING OUT OF THE USE OF YOUR CONTRIBUTIONS, EVEN IF THAT PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL SUGARCRM HAVE ANY LIABILITY TO YOU FOR ANY CLAIM, WHETHER IN CONTRACT, TORT OR ANY OTHER THEORY OF LIABILITY.
|
33
|
+
|
34
|
+
## Right to Change Terms
|
35
|
+
|
36
|
+
SugarCRM reserves the right to update and change these Terms from time to time without prior notice to you, so please check this file frequently for updates and changes.
|
37
|
+
|
38
|
+
## General Terms
|
39
|
+
|
40
|
+
These Terms and its rights or obligations cannot be assigned by you, by operation of law or otherwise, to any third party without SugarCRM’s prior written consent. These Terms will be governed by and under the laws of the State of California, United States, without giving effect to conflicts of law principles. If any provision of these Terms is found invalid, unlawful or otherwise unenforceable under applicable law, such provision will be replaced to the extent possible with a provision that comes closest to the intent of the original provision and all other provisions of these Terms shall continue in full force and effect. The waiver or failure of SugarCRM to enforce any of these Terms shall not be deemed a waiver of any further right under these Terms. The right to require performance of any duty hereunder is not barred by any prior waiver, forbearance or dealing. These Terms constitute the entire agreement between the parties with respect to the subject matter of these Terms, and supersede and merge all prior and contemporaneous proposals, understandings and all other agreements, oral and written, between the parties relating to the subject matter of these Terms.
|
data/README.md
CHANGED
@@ -4,9 +4,11 @@
|
|
4
4
|
[![Build Status](https://travis-ci.org/sugarcrm/rspec-tabular.svg?branch=master)](https://travis-ci.org/sugarcrm/rspec-tabular)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/sugarcrm/rspec-tabular/badges/gpa.svg)](https://codeclimate.com/github/sugarcrm/rspec-tabular)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/sugarcrm/rspec-tabular/badges/coverage.svg)](https://codeclimate.com/github/sugarcrm/rspec-tabular/coverage)
|
7
|
-
[![Inline docs](http://inch-ci.org/github/sugarcrm/rspec-tabular.svg)](http://inch-ci.org/github/sugarcrm/rspec-tabular)
|
8
7
|
[![License](http://img.shields.io/badge/license-Apache2-green.svg?style=flat)](LICENSE)
|
9
8
|
|
9
|
+
[![Inline docs](http://inch-ci.org/github/sugarcrm/rspec-tabular.svg)](http://inch-ci.org/github/sugarcrm/rspec-tabular)
|
10
|
+
[![RubyDoc](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/rspec-tabular)
|
11
|
+
|
10
12
|
Rspec extension for writing tabular examples
|
11
13
|
|
12
14
|
## Installation
|
@@ -130,14 +132,25 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
130
132
|
|
131
133
|
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
132
134
|
|
135
|
+
## Elsewhere on the web
|
136
|
+
|
137
|
+
Links to other places on the web where this projects exists:
|
138
|
+
|
139
|
+
* [Code Climate](https://codeclimate.com/github/sugarcrm/rspec-tabular)
|
140
|
+
* [CucumberPro](https://app.cucumber.pro/projects/rspec-tabular)
|
141
|
+
* [InchCI](http://inch-ci.org/github/sugarcrm/rspec-tabular)
|
142
|
+
* [Github](https://github.com/sugarcrm/rspec-tabular)
|
143
|
+
* [OpenHub](https://www.openhub.net/p/rspec-tabular)
|
144
|
+
* [RubyDoc](http://rubydoc.org/gems/rspec-tabular)
|
145
|
+
* [RubyGems](https://rubygems.org/gems/rspec-tabular)
|
146
|
+
* [Ruby LibHunt](https://ruby.libhunt.com/rspec-tabular-alternatives)
|
147
|
+
* [Ruby Toolbox](https://www.ruby-toolbox.com/projects/rspec-tabular)
|
148
|
+
* [TravisCI](https://travis-ci.org/sugarcrm/rspec-tabular)
|
149
|
+
|
133
150
|
## Contributing
|
134
151
|
|
135
|
-
|
136
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
137
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
138
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
139
|
-
5. Create a new Pull Request
|
152
|
+
See [CONTRIBUTING](CONTRIBUTING.md) for how you can contribute changes back into this project.
|
140
153
|
|
141
154
|
## License
|
142
155
|
|
143
|
-
Copyright
|
156
|
+
Copyright 2019 [SugarCRM Inc.](http://sugarcrm.com), released under the Apache2 License.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Tabular
|
5
|
+
# This class is a wrapper around a proc that will indicate
|
6
|
+
# to tabular that the provided proc should be run against
|
7
|
+
# a spec's context such that variables defined with let and
|
8
|
+
# helper methods like instance_double are available.
|
9
|
+
#
|
10
|
+
# This class should not be called directly. Instead use the
|
11
|
+
# helper function `with_context`
|
12
|
+
class Wrapped
|
13
|
+
def initialize(proc, pretty_val = nil)
|
14
|
+
@proc = proc
|
15
|
+
@pretty_val = pretty_val
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :proc
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
@pretty_val || 'wrapped_value'
|
22
|
+
end
|
23
|
+
|
24
|
+
alias inspect to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/rspec/tabular.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rspec/tabular/version'
|
4
|
+
require 'rspec/tabular/wrapped'
|
4
5
|
|
5
|
-
module
|
6
|
+
module RSpec
|
6
7
|
# rubocop:disable all
|
7
8
|
|
8
9
|
# This module will allow examples to be specified in a more clean tabular
|
@@ -69,6 +70,17 @@ module Rspec
|
|
69
70
|
# side_effects_with 'value4', 'value5', 'value6'
|
70
71
|
# end
|
71
72
|
#
|
73
|
+
# Values that need an it/before scope can be wrapped using the helper function
|
74
|
+
# `with_context`. An optional 2nd parameter will provide a value to write out
|
75
|
+
# to the reporter
|
76
|
+
#
|
77
|
+
# describe 'a thing with item compairsons' do
|
78
|
+
# subject { subject.thing(input1) }
|
79
|
+
#
|
80
|
+
# inputs :input1
|
81
|
+
# it_with with_context(proc { instance_double(ThingyModel) }), 'foobar'
|
82
|
+
# it_with with_context(proc { double }, 'double'), 'foobar'
|
83
|
+
#
|
72
84
|
# Inputs can also be specified as block arguments. I am not sure if this is
|
73
85
|
# really useful, it might be deprecated in the future.
|
74
86
|
#
|
@@ -82,90 +94,107 @@ module Rspec
|
|
82
94
|
|
83
95
|
# rubocop:enable all
|
84
96
|
module Tabular
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
def it_with(*input_values, &block)
|
90
|
-
if block.nil? && (metadata[:inputs].size == input_values.size - 1)
|
91
|
-
expected_value = input_values.pop
|
92
|
-
block = proc { is_expected.to eq(expected_value) }
|
97
|
+
# Example group methods e.g. inside describe/context block
|
98
|
+
module ExampleGroup
|
99
|
+
def inputs(*args)
|
100
|
+
metadata[:inputs] ||= args
|
93
101
|
end
|
94
102
|
|
95
|
-
|
96
|
-
metadata[:inputs].
|
97
|
-
|
98
|
-
|
103
|
+
def it_with(*input_values, &block)
|
104
|
+
if block.nil? && (metadata[:inputs].size == input_values.size - 1)
|
105
|
+
expected_value = input_values.pop
|
106
|
+
block = proc { is_expected.to eq(expected_value) }
|
99
107
|
end
|
100
108
|
|
101
|
-
|
109
|
+
context("with #{Hash[metadata[:inputs].zip input_values]}") do
|
110
|
+
metadata[:inputs].each_index do |i|
|
111
|
+
key = metadata[:inputs][i]
|
112
|
+
value = input_values[i]
|
113
|
+
let(key) { _unwrap(value) }
|
114
|
+
end
|
115
|
+
|
116
|
+
example(nil, { input_values: input_values }, &block)
|
117
|
+
end
|
102
118
|
end
|
103
|
-
end
|
104
119
|
|
105
|
-
|
120
|
+
alias specify_with it_with
|
106
121
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
begin
|
122
|
+
# Example with an implicit subject execution
|
123
|
+
def side_effects_with(*args)
|
124
|
+
it_with(*args) do
|
111
125
|
subject
|
112
|
-
rescue Exception # rubocop:disable Lint/
|
126
|
+
rescue Exception # rubocop:disable Lint/SuppressedException, Lint/RescueException
|
113
127
|
end
|
114
128
|
end
|
115
|
-
end
|
116
129
|
|
117
|
-
|
118
|
-
|
119
|
-
|
130
|
+
def raise_error_with(*args)
|
131
|
+
raise_error_args = args
|
132
|
+
it_with_args = raise_error_args.slice!(0, metadata[:inputs].size)
|
120
133
|
|
121
|
-
|
122
|
-
|
134
|
+
it_with(*it_with_args) do
|
135
|
+
expect { subject }.to raise_error(*raise_error_args)
|
136
|
+
end
|
123
137
|
end
|
124
|
-
end
|
125
138
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
139
|
+
def its_with(attribute, *input_values, &block)
|
140
|
+
if block.nil? && (metadata[:inputs].size == input_values.size - 1)
|
141
|
+
expected_value = input_values.pop
|
142
|
+
block = proc { should eq(expected_value) }
|
143
|
+
end
|
131
144
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
145
|
+
describe("#{attribute} with #{input_values.join(', ')}") do
|
146
|
+
if attribute.is_a?(Array)
|
147
|
+
let(:__its_subject) { subject[*attribute] }
|
148
|
+
else
|
149
|
+
let(:__its_subject) do
|
150
|
+
attribute_chain = attribute.to_s.split('.')
|
151
|
+
attribute_chain.inject(subject) do |inner_subject, attr|
|
152
|
+
inner_subject.send(attr)
|
153
|
+
end
|
140
154
|
end
|
141
155
|
end
|
142
|
-
end
|
143
156
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
157
|
+
def should(matcher = nil, message = nil) # rubocop:disable Lint/NestedMethodDefinition
|
158
|
+
RSpec::Expectations::PositiveExpectationHandler.handle_matcher(
|
159
|
+
__its_subject, matcher, message
|
160
|
+
)
|
161
|
+
end
|
149
162
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
163
|
+
def should_not(matcher = nil, message = nil) # rubocop:disable Lint/NestedMethodDefinition
|
164
|
+
RSpec::Expectations::NegativeExpectationHandler.handle_matcher(
|
165
|
+
__its_subject, matcher, message
|
166
|
+
)
|
167
|
+
end
|
155
168
|
|
156
|
-
|
157
|
-
|
158
|
-
|
169
|
+
metadata[:inputs].each_index do |i|
|
170
|
+
key = metadata[:inputs][i]
|
171
|
+
value = input_values[i]
|
172
|
+
let(key) { _unwrap(value) }
|
173
|
+
end
|
174
|
+
|
175
|
+
example(nil, { input_values: input_values }, &block)
|
159
176
|
end
|
177
|
+
end
|
160
178
|
|
161
|
-
|
179
|
+
def with_context(proc, pretty_val = nil)
|
180
|
+
RSpec::Tabular::Wrapped.new(proc, pretty_val)
|
162
181
|
end
|
182
|
+
|
183
|
+
# TODO: it_behaves_like_with(example_name, inputs)
|
163
184
|
end
|
164
185
|
|
165
|
-
#
|
186
|
+
# example level methods: e.g. inside before/it
|
187
|
+
module Example
|
188
|
+
def _unwrap(value)
|
189
|
+
return value unless value.is_a?(RSpec::Tabular::Wrapped)
|
190
|
+
|
191
|
+
instance_eval(&value.proc)
|
192
|
+
end
|
193
|
+
end
|
166
194
|
end
|
167
195
|
end
|
168
196
|
|
169
197
|
RSpec.configure do |config|
|
170
|
-
config.extend(
|
198
|
+
config.extend(RSpec::Tabular::ExampleGroup)
|
199
|
+
config.include(RSpec::Tabular::Example)
|
171
200
|
end
|
data/rspec-tabular.gemspec
CHANGED
@@ -22,13 +22,13 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.5.0'
|
26
26
|
|
27
27
|
spec.add_runtime_dependency 'rspec-core', '>= 2.99.0'
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
30
|
-
spec.add_development_dependency 'rake', '~>
|
31
|
-
spec.add_development_dependency 'rspec', '~>
|
30
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
32
32
|
|
33
33
|
# Dependencies whose APIs we do not really depend upon, and can be upgraded
|
34
34
|
# without limiting.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-tabular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Sullivan Cant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.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: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '3.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '3.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler-audit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +148,8 @@ files:
|
|
148
148
|
- ".rubocop.yml"
|
149
149
|
- ".travis.yml"
|
150
150
|
- CHANGELOG.md
|
151
|
+
- CONTRIBUTING.md
|
152
|
+
- CONTRIBUTOR_TERMS.md
|
151
153
|
- Gemfile
|
152
154
|
- LICENSE
|
153
155
|
- README.md
|
@@ -157,6 +159,7 @@ files:
|
|
157
159
|
- doc/dependency_decisions.yml
|
158
160
|
- lib/rspec/tabular.rb
|
159
161
|
- lib/rspec/tabular/version.rb
|
162
|
+
- lib/rspec/tabular/wrapped.rb
|
160
163
|
- rspec-tabular.gemspec
|
161
164
|
homepage: http://github.com/sugarcrm/rspec-tabular
|
162
165
|
licenses:
|
@@ -170,15 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
173
|
requirements:
|
171
174
|
- - ">="
|
172
175
|
- !ruby/object:Gem::Version
|
173
|
-
version: 2.
|
176
|
+
version: 2.5.0
|
174
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
178
|
requirements:
|
176
179
|
- - ">="
|
177
180
|
- !ruby/object:Gem::Version
|
178
181
|
version: '0'
|
179
182
|
requirements: []
|
180
|
-
|
181
|
-
rubygems_version: 2.6.11
|
183
|
+
rubygems_version: 3.0.3
|
182
184
|
signing_key:
|
183
185
|
specification_version: 4
|
184
186
|
summary: RSpec extension for writing tabular examples.
|