rspec-tabular 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +39 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +19 -3
- data/.ruby-version +1 -0
- data/CHANGELOG.md +12 -2
- data/CONTRIBUTING.md +24 -0
- data/CONTRIBUTOR_TERMS.md +40 -0
- data/README.md +18 -8
- data/Rakefile +10 -0
- data/doc/dependency_decisions.yml +3 -3
- 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 +10 -6
- metadata +69 -23
- data/.travis.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 759c494edba6058e84dcba52b20e05ada5690426569c40b189ff572f4472764a
|
4
|
+
data.tar.gz: bda5059485b15330f16967a6323642755b1e93b73751e226f02cf200159fa221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedd35a8bbda5118e78fd9bbd8ef5cf32e6d5bc1d4d3fcf6d626f8aab84899bb841155adfca10443b9f78b0c6135b110926dc9abe6166e3d3d707bf88974b9db
|
7
|
+
data.tar.gz: 2078c1d089e0056733227e1ab25647d5d31db456530a0af1887926565ff2eeb37742484f1ea75c7ac833de26ee395c67ed319a415814e2dc0ac0bef4fe873640
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
schedule:
|
5
|
+
- cron: '0 1 * * 0' # every Sunday at 1am
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
os: [ubuntu-latest, macos-latest]
|
12
|
+
ruby: [3.1, 3.2, 3.3, 3.4, head, jruby, jruby-head]
|
13
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || endsWith(matrix.ruby, 'jruby') }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rake spec
|
22
|
+
coverage:
|
23
|
+
needs: [ test ]
|
24
|
+
name: coverage
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v4
|
28
|
+
- uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
bundler-cache: true
|
31
|
+
- run: bundle exec rake
|
32
|
+
env:
|
33
|
+
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.CUCUMBER_PUBLISH_TOKEN }}
|
34
|
+
- uses: paambaati/codeclimate-action@v9.0.0
|
35
|
+
env:
|
36
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
37
|
+
with:
|
38
|
+
coverageLocations: |
|
39
|
+
${{ github.workspace }}/coverage/lcov/*.lcov:lcov
|
data/.gitignore
CHANGED
@@ -28,7 +28,6 @@ build/
|
|
28
28
|
# for a library or gem, you might want to ignore these files since the code is
|
29
29
|
# intended to run in multiple environments; otherwise, check them in:
|
30
30
|
Gemfile.lock
|
31
|
-
.ruby-version
|
32
31
|
.ruby-gemset
|
33
32
|
|
34
33
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
data/.rubocop.yml
CHANGED
@@ -1,14 +1,30 @@
|
|
1
|
-
require:
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-rspec
|
2
5
|
|
3
|
-
|
6
|
+
AllCops:
|
7
|
+
NewCops: enable
|
8
|
+
|
9
|
+
Gemspec/DevelopmentDependencies:
|
10
|
+
EnforcedStyle: gemspec
|
11
|
+
|
12
|
+
Layout/LineLength:
|
4
13
|
Max: 100
|
5
14
|
|
6
15
|
Metrics/MethodLength:
|
7
|
-
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Enabled: false
|
8
20
|
|
9
21
|
RSpec/EmptyExampleGroup:
|
10
22
|
Enabled: false
|
11
23
|
|
24
|
+
RSpec/ImplicitSubject:
|
25
|
+
Enabled: false
|
26
|
+
|
12
27
|
Metrics/BlockLength:
|
28
|
+
Max: 100
|
13
29
|
Exclude:
|
14
30
|
- spec/**/*
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.2
|
data/CHANGELOG.md
CHANGED
@@ -4,11 +4,21 @@ 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.4.0] - 2025-02-12
|
10
|
+
### Changed
|
11
|
+
- update the required ruby version from v2.2 to v3.1
|
12
|
+
|
13
|
+
## [0.3.0] - 2022-01-24
|
14
|
+
### Added
|
15
|
+
- `with_context` to allow table inputs to be handle within the example context
|
16
|
+
|
17
|
+
## [0.2.0] - 2018-08-19
|
8
18
|
### Changed
|
9
19
|
- support checking Exception class and message in the same row
|
10
20
|
- catch exceptions when checking side effects, instead of raising the exception
|
11
21
|
|
12
|
-
## 0.0
|
22
|
+
## [0.1.0] - 2015-10-01
|
13
23
|
### Added
|
14
24
|
- 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
@@ -1,12 +1,13 @@
|
|
1
1
|
# Rspec::Tabular
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rspec-tabular.svg)](http://badge.fury.io/rb/rspec-tabular)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/sugarcrm/rspec-tabular/actions/workflows/ci.yml/badge.svg)](https://github.com/sugarcrm/rspec-tabular/actions/workflows/ci.yml)
|
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
|
+
[![RubyDoc](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://rubydoc.info/gems/rspec-tabular)
|
10
|
+
|
10
11
|
Rspec extension for writing tabular examples
|
11
12
|
|
12
13
|
## Installation
|
@@ -130,14 +131,23 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
130
131
|
|
131
132
|
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
133
|
|
134
|
+
## Elsewhere on the web
|
135
|
+
|
136
|
+
Links to other places on the web where this projects exists:
|
137
|
+
|
138
|
+
* [Code Climate](https://codeclimate.com/github/sugarcrm/rspec-tabular)
|
139
|
+
* [CucumberPro](https://app.cucumber.pro/projects/rspec-tabular)
|
140
|
+
* [Github](https://github.com/sugarcrm/rspec-tabular)
|
141
|
+
* [OpenHub](https://www.openhub.net/p/rspec-tabular)
|
142
|
+
* [RubyDoc](https://rubydoc.org/gems/rspec-tabular)
|
143
|
+
* [RubyGems](https://rubygems.org/gems/rspec-tabular)
|
144
|
+
* [Ruby LibHunt](https://ruby.libhunt.com/rspec-tabular-alternatives)
|
145
|
+
* [Ruby Toolbox](https://www.ruby-toolbox.com/projects/rspec-tabular)
|
146
|
+
|
133
147
|
## Contributing
|
134
148
|
|
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
|
149
|
+
See [CONTRIBUTING](CONTRIBUTING.md) for how you can contribute changes back into this project.
|
140
150
|
|
141
151
|
## License
|
142
152
|
|
143
|
-
Copyright
|
153
|
+
Copyright 2025 [SugarCRM Inc.](http://sugarcrm.com), released under the [Apache2 License](https://www.apache.org/licenses/LICENSE-2.0.html).
|
data/Rakefile
CHANGED
@@ -37,4 +37,14 @@ task :license_finder do
|
|
37
37
|
abort('LicenseFinder failed') unless $CHILD_STATUS.success?
|
38
38
|
end
|
39
39
|
|
40
|
+
desc 'Show which specified gems are outdated'
|
41
|
+
task 'bundle:outdated' do
|
42
|
+
bundle_outdated_report_pathname =
|
43
|
+
Pathname(Rake.application.original_dir).join('tmp', 'bundle_outdated.txt')
|
44
|
+
bundle_outdated_report_pathname.dirname.mkpath
|
45
|
+
|
46
|
+
# TODO: Should consider re-writing this without using `tee`.
|
47
|
+
sh("bundle outdated --only-explicit | tee #{bundle_outdated_report_pathname}")
|
48
|
+
end
|
49
|
+
|
40
50
|
task default: %i[spec rubocop bundle:audit license_finder]
|
@@ -5,19 +5,19 @@
|
|
5
5
|
:why:
|
6
6
|
:versions: []
|
7
7
|
:when: 2018-06-13 15:20:17.351348000 Z
|
8
|
-
- - :
|
8
|
+
- - :permit
|
9
9
|
- Apache 2.0
|
10
10
|
- :who: Andrew Sullivan Cant <mail@andrewsullivancant.ca>
|
11
11
|
:why: SugarCRM's primary approved open source license
|
12
12
|
:versions: []
|
13
13
|
:when: 2018-06-18 19:28:33.314061000 Z
|
14
|
-
- - :
|
14
|
+
- - :permit
|
15
15
|
- MIT
|
16
16
|
- :who: Andrew Sullivan Cant <mail@andrewsullivancant.ca>
|
17
17
|
:why: SugarCRM's secondary approved open source license
|
18
18
|
:versions: []
|
19
19
|
:when: 2018-06-13 15:18:36.240771000 Z
|
20
|
-
- - :
|
20
|
+
- - :permit
|
21
21
|
- BSD
|
22
22
|
- :who: Andrew Sullivan Cant <mail@andrewsullivancant.ca>
|
23
23
|
:why: SugarCRM's secondary approved open source 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 #{metadata[:inputs].zip(input_values).to_h}") 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
@@ -18,23 +18,27 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
19
|
f.match(%r{^(test|spec|features)/})
|
20
20
|
end
|
21
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
|
-
spec.required_ruby_version = '>=
|
24
|
+
spec.required_ruby_version = '>= 3.1.2'
|
26
25
|
|
27
|
-
spec.
|
26
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
28
27
|
|
29
|
-
spec.
|
30
|
-
|
31
|
-
spec.add_development_dependency '
|
28
|
+
spec.add_dependency 'rspec-core', '>= 2.99.0'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.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.
|
35
35
|
spec.add_development_dependency 'bundler-audit'
|
36
36
|
spec.add_development_dependency 'license_finder'
|
37
|
+
spec.add_development_dependency 'logger'
|
37
38
|
spec.add_development_dependency 'rubocop'
|
39
|
+
spec.add_development_dependency 'rubocop-performance'
|
40
|
+
spec.add_development_dependency 'rubocop-rake'
|
38
41
|
spec.add_development_dependency 'rubocop-rspec'
|
39
42
|
spec.add_development_dependency 'simplecov'
|
43
|
+
spec.add_development_dependency 'simplecov-lcov'
|
40
44
|
end
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Sullivan Cant
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -25,49 +25,49 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.99.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.5'
|
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: '3.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: bundler-audit
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
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: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: license_finder
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: logger
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -108,6 +108,34 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: rubocop-rspec
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +164,20 @@ dependencies:
|
|
136
164
|
- - ">="
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov-lcov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
139
181
|
description: RSpec DSL which makes is easier and cleaner to write tabular examples.
|
140
182
|
email:
|
141
183
|
- acant@sugarcrm.com
|
@@ -143,11 +185,14 @@ executables: []
|
|
143
185
|
extensions: []
|
144
186
|
extra_rdoc_files: []
|
145
187
|
files:
|
188
|
+
- ".github/workflows/ci.yml"
|
146
189
|
- ".gitignore"
|
147
190
|
- ".rspec"
|
148
191
|
- ".rubocop.yml"
|
149
|
-
- ".
|
192
|
+
- ".ruby-version"
|
150
193
|
- CHANGELOG.md
|
194
|
+
- CONTRIBUTING.md
|
195
|
+
- CONTRIBUTOR_TERMS.md
|
151
196
|
- Gemfile
|
152
197
|
- LICENSE
|
153
198
|
- README.md
|
@@ -157,12 +202,14 @@ files:
|
|
157
202
|
- doc/dependency_decisions.yml
|
158
203
|
- lib/rspec/tabular.rb
|
159
204
|
- lib/rspec/tabular/version.rb
|
205
|
+
- lib/rspec/tabular/wrapped.rb
|
160
206
|
- rspec-tabular.gemspec
|
161
207
|
homepage: http://github.com/sugarcrm/rspec-tabular
|
162
208
|
licenses:
|
163
209
|
- Apache-2.0
|
164
|
-
metadata:
|
165
|
-
|
210
|
+
metadata:
|
211
|
+
rubygems_mfa_required: 'true'
|
212
|
+
post_install_message:
|
166
213
|
rdoc_options: []
|
167
214
|
require_paths:
|
168
215
|
- lib
|
@@ -170,16 +217,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
217
|
requirements:
|
171
218
|
- - ">="
|
172
219
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
220
|
+
version: 3.1.2
|
174
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
222
|
requirements:
|
176
223
|
- - ">="
|
177
224
|
- !ruby/object:Gem::Version
|
178
225
|
version: '0'
|
179
226
|
requirements: []
|
180
|
-
|
181
|
-
|
182
|
-
signing_key:
|
227
|
+
rubygems_version: 3.3.7
|
228
|
+
signing_key:
|
183
229
|
specification_version: 4
|
184
230
|
summary: RSpec extension for writing tabular examples.
|
185
231
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2
|
5
|
-
- 2.3
|
6
|
-
- 2.4
|
7
|
-
- 2.5
|
8
|
-
- ruby-head
|
9
|
-
matrix:
|
10
|
-
allow_failures:
|
11
|
-
- rvm: ruby-head
|
12
|
-
- rvm: 2.4
|
13
|
-
os: osx
|
14
|
-
os:
|
15
|
-
- linux
|
16
|
-
- osx
|
17
|
-
sudo: false
|
18
|
-
before_script:
|
19
|
-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter ; fi
|
20
|
-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter ; fi
|
21
|
-
- chmod +x ./cc-test-reporter
|
22
|
-
- ./cc-test-reporter before-build
|
23
|
-
after_script:
|
24
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|