rspec_n 1.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +3 -0
- data/.github/workflows/check_pull_request.yml +54 -0
- data/.rubocop.yml +11 -1
- data/CHANGELOG.md +18 -3
- data/Gemfile +11 -0
- data/LICENSE.md +6 -6
- data/README.md +54 -31
- data/Rakefile +2 -2
- data/bin/console +3 -4
- data/exe/rspec_n +11 -10
- data/lib/rspec_n/helpers/arguments_helper.rb +26 -0
- data/lib/rspec_n/runner.rb +1 -1
- data/lib/rspec_n/version.rb +1 -1
- data/rspec_n.gemspec +3 -11
- metadata +9 -77
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ea1bbeb02bb4db25b1cf60151cc6d84023734914875d0b4f20d2fa8e9d25bac
|
4
|
+
data.tar.gz: db723b51e76c3d2d80f6875bd0706fd1dd720e0c067f9b31e1521852e15130e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dfc98c7a039a9c334f87dba49b80b97167b7b30bfe55a22912a66afcf51fd080f2f8e6582deac86447ce7bfb8a1068288604b66eb1d09e119c4a143ecbd019d
|
7
|
+
data.tar.gz: c152cc6b58f3c0a9948e5486467eb8eaeb39d4e21307a198897de0480bb97e982fad1ab2faa58a1494185c1f826b6b7ae927cc586a6f60306ef48b7a92f1229d
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# This workflow will download prebuilt Ruby versions, install dependencies and run checks against Pull Requests.
|
2
|
+
|
3
|
+
name: Check Pull Request
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
branches: [ master ]
|
7
|
+
env:
|
8
|
+
# The pull request can have less than, or equal to, this number of rubocop issues and pass.
|
9
|
+
RUBOCOP_ISSUE_THRESHOLD: 5
|
10
|
+
jobs:
|
11
|
+
rspec:
|
12
|
+
name: Run RSpec
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3']
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
21
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
|
+
- name: Execute rspec command
|
27
|
+
run: bundle exec rspec
|
28
|
+
rubocop:
|
29
|
+
name: Run Rubocop
|
30
|
+
runs-on: ubuntu-latest
|
31
|
+
strategy:
|
32
|
+
matrix:
|
33
|
+
ruby-version: ['3.0']
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Set up Ruby
|
37
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
38
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
39
|
+
uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby-version }}
|
42
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
43
|
+
- name: Execute rubo command
|
44
|
+
run: bundle exec rubo
|
45
|
+
- name: Evaluate rubo threshold
|
46
|
+
run: |
|
47
|
+
count=$(cat rubocop/total-violations-count.txt)
|
48
|
+
if [[ "$count" -gt $RUBOCOP_ISSUE_THRESHOLD ]]; then
|
49
|
+
echo "Failure: Found $count RuboCop issue(s). It must have $RUBOCOP_ISSUE_THRESHOLD or less. \
|
50
|
+
Run 'rubo' and resolve the issues listed in rubocop/style-issues.html"
|
51
|
+
exit 1
|
52
|
+
else
|
53
|
+
echo "Success: Found $count RuboCop issue(s), which is less than the limit of $RUBOCOP_ISSUE_THRESHOLD"
|
54
|
+
fi
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
# DO NOT MODIFY THIS FILE unless you want to deviate from the rubocop_plus ruleset.
|
2
|
+
|
3
|
+
# This file defines the settings used by rubocop when it runs. You would normally add your customizations directly to this
|
4
|
+
# file, but this file has been pre configured to read settings out of the rubocop_plus gem instead.
|
5
|
+
|
6
|
+
# Tell rubocop to load its settings from the rubocop_plus gem.
|
7
|
+
|
1
8
|
inherit_gem:
|
2
9
|
rubocop_plus: config/rubocop.yml
|
3
10
|
|
11
|
+
# Place custom settings below this comment. All customizations will OVERRIDE rubocop_plus rules. rubocop_plus & rubocop
|
12
|
+
# do not attempt to merge these settings with their defaults. Long term changes should be ported to the rubocop_plus gem.
|
13
|
+
|
4
14
|
AllCops:
|
5
|
-
TargetRubyVersion:
|
15
|
+
TargetRubyVersion: 3.0
|
6
16
|
|
7
17
|
Style/Documentation:
|
8
18
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
Issues are tracked at https://github.com/roberts1000/
|
3
|
+
Issues are tracked at https://github.com/roberts1000/rspec_n/issues. Issues marked as **(Internal)** only affect development.
|
4
|
+
|
5
|
+
## 1.6.0 (Feb 19, 2024)
|
6
|
+
|
7
|
+
1. [#105](../../issues/105): Use `colorize ~> 1.1.0`. **(Internal)**
|
8
|
+
1. [#108](../../issues/108): Remove Ruby 2.7 support.
|
9
|
+
1. [#110](../../issues/110): Add simple PR template.
|
10
|
+
1. [#112](../../issues/112): Add Ruby 3.2 support.
|
11
|
+
1. [#114](../../issues/114): Add Ruby 3.3 support.
|
12
|
+
|
13
|
+
## 1.5.0 (Aug 28, 2022)
|
14
|
+
|
15
|
+
1. [#53](../../issues/53): Add support for a config file.
|
16
|
+
1. [#87](../../issues/87): Add GitHub action workflow to check pull requests. **(Internal)**
|
17
|
+
1. [#93](../../issues/93): Make Ruby 2.7.0 the min supported Ruby.
|
18
|
+
1. [#97](../../issues/97): Add Ruby 3.1 support.
|
4
19
|
|
5
20
|
## 1.4.0 (May 16, 2021)
|
6
21
|
|
7
22
|
1. [#64](../../issues/64): Use `pry` `~> 0.14.0`. **(Internal)**
|
8
23
|
1. [#66](../../issues/66): Update ruby & bundler versions in `.travis.yml`. **(Internal)**
|
9
|
-
1. [#68](../../issues/68): Make Ruby 2.6 the minimum supported version.
|
24
|
+
1. [#68](../../issues/68): Make Ruby 2.6.0 the minimum supported version.
|
10
25
|
1. [#73](../../issues/73): Use `rake` `~> 13.0`. **(Internal)**
|
11
26
|
1. [#78](../../issues/78): Require `Pathname`.
|
12
27
|
1. [#83](../../issues/83): Use `rubocop_plus` `~> 2.0`. **(Internal)**
|
@@ -22,7 +37,7 @@ Issues are tracked at https://github.com/roberts1000/rubocop_plus/issues. Change
|
|
22
37
|
1. [#36](../../issues/36): Add instructions for installing `rspec_n` in project Gemfiles.
|
23
38
|
1. [#38](../../issues/38): Stop `--order rand` from being added to the final command when a custom order is specified.
|
24
39
|
1. [#41](../../issues/41): Remove locking to a specify version of Ruby in development. **(Internal)**
|
25
|
-
1. [#43](../../issues/43): Use pry 0.12.x for development. **(Internal)**
|
40
|
+
1. [#43](../../issues/43): Use `pry` `0.12.x` for development. **(Internal)**
|
26
41
|
|
27
42
|
## 1.2.1 (Mar 06, 2019)
|
28
43
|
|
data/Gemfile
CHANGED
@@ -2,3 +2,14 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in rspec_n.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'rubocop_plus', '~> 2.0', require: false
|
8
|
+
end
|
9
|
+
|
10
|
+
group :develoment, :test do
|
11
|
+
gem 'bundler', '~> 2.0'
|
12
|
+
gem 'pry', '~> 0.14.0'
|
13
|
+
gem 'rake', '~> 13.0'
|
14
|
+
gem 'rspec', '~> 3.0'
|
15
|
+
end
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2021 roberts1000
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
# rspec_n
|
2
2
|
|
3
|
-
rspec_n is a Ruby gem that makes it easy to run a project's RSpec test suite N times. You can customize the command that is used to start RSpec, or let rspec_n guess the best command (based on the files in your project). rspec_n is useful for finding repeatability issues in
|
3
|
+
rspec_n is a Ruby gem that makes it easy to run a project's RSpec test suite N times. You can customize the command that is used to start RSpec, or let rspec_n guess the best command (based on the files in your project). rspec_n is useful for finding repeatability issues in RSpec test suites.
|
4
4
|
|
5
5
|
![example](https://user-images.githubusercontent.com/2053901/53691471-c6956880-3d4c-11e9-8248-68bbb4c24786.png)
|
6
6
|
|
7
|
-
|
7
|
+
#### Automatic Command Selection
|
8
|
+
|
9
|
+
rspec_n inspects files in your project and determines the best way to start RSpec. If it can't make an educated guess, it will use `bundle exec rspec` as the base command and add any extra information you've entered on the command line (like the order or paths). The following is a list of project types that rspec_n can identify and the associated commands it will try to execute:
|
10
|
+
|
11
|
+
1. Ruby on Rails Applications: `DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=test bundle exec rake db:drop db:create db:migrate && bundle exec rspec`.
|
12
|
+
2. Everything else: `bundle exec rspec`.
|
13
|
+
|
14
|
+
**Note:** You can override this behavior by using the `-c` option, which lets you specify your own command. See the [Use a Custom Command to Start RSpec](#Use-a-Custom-Command-to-Start-RSpec) section for more info.
|
8
15
|
|
9
|
-
|
16
|
+
## Versioning Strategy
|
10
17
|
|
11
|
-
|
18
|
+
Releases are versioned using [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) with the following caveats:
|
19
|
+
|
20
|
+
1. Support for Ruby versions, that reach EOL, can be removed in a major **or** minor release.
|
12
21
|
|
13
22
|
## Supported Ruby Versions
|
14
23
|
|
15
|
-
Ruby
|
24
|
+
Ruby 3.0+ is supported.
|
16
25
|
|
17
26
|
## Installation
|
18
27
|
|
@@ -20,7 +29,7 @@ Install by executing:
|
|
20
29
|
|
21
30
|
$ gem install rspec_n
|
22
31
|
|
23
|
-
The gem will install an executable called `rspec_n`.
|
32
|
+
The gem will install an executable called `rspec_n`.
|
24
33
|
|
25
34
|
Add the following to your project's `.gitignore` to exclude the output generated by rspec_n from your project's repo:
|
26
35
|
|
@@ -28,7 +37,7 @@ Add the following to your project's `.gitignore` to exclude the output generated
|
|
28
37
|
|
29
38
|
#### Usage in a Gemfile
|
30
39
|
|
31
|
-
If you
|
40
|
+
If you add rspec_n to your Gemfile, use the `require: false` option so rspec_n isn't loaded into your app. rspec_n doesn't provide any runtime benefit to apps and requiring it will add unnecessary code to your project. Also, rspec_n is designed as a standalone command line tool and isn't tested for compatibility inside other apps.
|
32
41
|
|
33
42
|
```ruby
|
34
43
|
gem 'rspec_n', require: false
|
@@ -36,58 +45,76 @@ gem 'rspec_n', require: false
|
|
36
45
|
|
37
46
|
## Usage
|
38
47
|
|
48
|
+
### Basic Usage
|
49
|
+
|
39
50
|
The simplest way to run rspec_n is to give it a positive integer which tells it how many times to run RSpec:
|
40
51
|
|
41
52
|
$ rspec_n 5
|
42
53
|
|
43
|
-
As
|
54
|
+
As iterations complete, summary output is sent to the screen and detailed output is written to files (in the project's root).
|
44
55
|
|
45
|
-
|
56
|
+
To target specific specs, provide one or more paths. You can do anything you would normally do when passing paths to RSpec:
|
46
57
|
|
47
58
|
$ rspec_n 5 spec/path/to/something_spec.rb
|
48
59
|
$ rspec_n 5 spec/path/to/folder spec/path/to/some/other/file_spec.rb
|
49
60
|
$ rspec_n 5 spec/path/to/folder
|
50
61
|
$ rspec_n 5 spec/path/to/something_spec.rb:5
|
51
62
|
|
52
|
-
By default, `--order rand` is sent to RSpec to force it to run specs in random order. You can use a `defined` order if you don't want randomness:
|
63
|
+
By default, `--order rand` is always sent to RSpec to force it to run specs in random order. You can use a `defined` order if you don't want randomness:
|
53
64
|
|
54
65
|
$ rspec_n 5 --order defined
|
55
66
|
|
56
|
-
Or, let the configuration
|
67
|
+
Or, let the RSpec configuration in the project determine the order:
|
57
68
|
|
58
69
|
$ rspec_n 5 --order project
|
59
70
|
|
60
|
-
|
61
|
-
|
62
|
-
rspec_n inspects files in your project so it can pick the best way to start RSpec. If it can't make an educated guess, it will use `bundle exec rspec` as the base command and add any extra information you've entered on the command line (like the order or paths). The following is a list of project types that rspec_n can identify and the associated commands it will try to execute:
|
63
|
-
|
64
|
-
1. Ruby on Rails Applications: `DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=test bundle exec rake db:drop db:create db:migrate && bundle exec rspec`.
|
65
|
-
2. Everything else: `bundle exec rspec`.
|
66
|
-
|
67
|
-
#### Use Custom Command to Start RSpec
|
71
|
+
### Use a Custom Command to Start RSpec
|
68
72
|
|
69
73
|
Use the `-c` option if you want to specify your own command. The following example deletes the `tmp` folder before starting RSpec:
|
70
74
|
|
71
75
|
$ rspec_n 5 -c 'rm -rf tmp && bundle exec rspec'
|
72
76
|
|
73
|
-
There are couple points to consider:
|
77
|
+
There are a couple points to consider:
|
74
78
|
|
75
79
|
1. Wrap your entire command in a single or double quoted string.
|
76
|
-
1. Use
|
77
|
-
1. rspec_n was created to help discover flaky test suites so it
|
80
|
+
1. Use `&&` to create compound commands.
|
81
|
+
1. rspec_n was created to help discover flaky test suites so it will add `--order rand` to your custom command (which gets passed to RSpec and causes RSpec to run tests randomly). If you need to change the test order, you must add the `--order defined` or `--order project` options to the control the order like this:
|
78
82
|
|
79
|
-
|
83
|
+
```
|
84
|
+
$ rspec_n 5 -c 'rm -rf tmp && bundle exec rspec' --order defined
|
85
|
+
```
|
86
|
+
|
87
|
+
### Control the File Output
|
80
88
|
|
81
|
-
rspec_n writes output for each iteration
|
89
|
+
rspec_n writes output to the project's root folder, for each iteration, to files with the iteration number in the name (`rspec_n_iteration.1`, `rspec_n_iteration.2`, etc...). If you want to disable this, add the `--no-file` option to the command.
|
82
90
|
|
83
91
|
$ rspec_n 5 --no-file
|
84
92
|
|
85
93
|
**Note:** rspec_n deletes all files matching `rspec_n_iteration.*` when it starts, so be sure to move those files to another location if you want to save them.
|
86
94
|
|
87
|
-
|
95
|
+
### Stop on First Failure
|
88
96
|
|
89
97
|
You can tell rspec_n to abort the first time an iteration fails by using the `-s` flag. All remaining iterations are skipped.
|
90
98
|
|
99
|
+
### Run Specs in Parallel
|
100
|
+
|
101
|
+
rspec_n doesn't directly support running specs in parallel, however, you should be able to use the `-c` option to pass a rspec_n the command you use to run parallel specs.
|
102
|
+
|
103
|
+
## Configuration
|
104
|
+
|
105
|
+
You can create a `.rspec_n` file in your project's root and add command line options to it. They'll be used if `rspec_n` is run without options. Options are any arguments that start with `-` or `--`. For example, `rspec_n 10` or `rspec_n 10 spec/some_spec.rb` will make rspec_n consider `.rspec_n`, but `rspec_n 10 -c "rm -rf /tmp/* && bundle exec rspec"` won't.
|
106
|
+
|
107
|
+
Example file format:
|
108
|
+
|
109
|
+
```text
|
110
|
+
--no-file
|
111
|
+
-s
|
112
|
+
--order defined
|
113
|
+
-c "rm -rf tmp && bundle exec rspec"
|
114
|
+
```
|
115
|
+
|
116
|
+
The config file can be multi line or single line.
|
117
|
+
|
91
118
|
## Understanding the Results
|
92
119
|
|
93
120
|
rspec_n uses the `STDOUT`, `STDERR` and `EXIT STATUS` of the `rspec` command to decide if the run passed or failed. The run is considered successful if RSpec returns an `EXIT STATUS` of `0` **regardless of any content in the STDERR stream**. rspec_n considers the run to be a failure if RSpec's `EXIT STATUS` `> 0`.
|
@@ -110,11 +137,11 @@ That's it!
|
|
110
137
|
|
111
138
|
Run the automated test suite with:
|
112
139
|
|
113
|
-
$
|
140
|
+
$ rspec
|
114
141
|
|
115
142
|
### Start a Console
|
116
143
|
|
117
|
-
Choose one of the following to start a
|
144
|
+
Choose one of the following to start a console with the gem loaded:
|
118
145
|
|
119
146
|
```bash
|
120
147
|
$ bin/console # for Pry
|
@@ -129,7 +156,3 @@ Contributions are welcome. Please us the following process when submitting work:
|
|
129
156
|
1. Fork the project.
|
130
157
|
1. Create a branch. The name of the branch should start with the issue number that the branch will address.
|
131
158
|
1. Submit the PR. In the PR comment (in the UI), add `Closes #xyz` or `Supports #xyz` where `xyz` is the issue number that the PR addresses. The title of the PR (in the UI) should start with `[PR for #xyz] `.
|
132
|
-
|
133
|
-
## License
|
134
|
-
|
135
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -6,8 +6,7 @@ require "rspec_n"
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
|
-
|
10
|
-
Pry.start
|
9
|
+
# Run 'rake console' to start a pry console.
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
require "irb"
|
12
|
+
IRB.start(__FILE__)
|
data/exe/rspec_n
CHANGED
@@ -18,17 +18,18 @@ require "cri"
|
|
18
18
|
require "fileutils"
|
19
19
|
require "rspec_n/version"
|
20
20
|
require "rspec_n/constants"
|
21
|
+
require "rspec_n/helpers/arguments_helper"
|
21
22
|
require "rspec_n/errors/bad_option"
|
22
23
|
|
23
24
|
# rubocop:disable Metrics/BlockLength
|
24
25
|
command = Cri::Command.define do
|
25
26
|
usage 'rspec_n [iterations] [options]'
|
26
27
|
description "rspec_n is an executable installed by the rspec_n Ruby gem. It provides a " \
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
"way to re-run an RSpec test suite 'N' times, which is useful when determining " \
|
29
|
+
"if a test suite is consistent.\n\n" \
|
30
|
+
"STATUS CODES\n\n" \
|
31
|
+
"0 - rspec_n ran successfully \u00A0\n" \
|
32
|
+
"1 - problem with the commandline options \u00A0"
|
32
33
|
|
33
34
|
flag :h, :help, 'show help' do |_value, cmd|
|
34
35
|
puts cmd.help
|
@@ -36,17 +37,17 @@ command = Cri::Command.define do
|
|
36
37
|
end
|
37
38
|
|
38
39
|
command_description = "By default, rspec_n will guess the best command to run RSpec; " \
|
39
|
-
|
40
|
-
|
40
|
+
"override it by setting a custom command; wrap the entire command in single or double quotes; " \
|
41
|
+
"join multiple commands with '&&'"
|
41
42
|
option :c, :command, command_description, argument: :required
|
42
43
|
|
43
44
|
flag nil, "no-file", "Do not write iteration output to files"
|
44
45
|
|
45
46
|
flag nil, "timestamp", "Write iteration output to a timestamped directory, which can " \
|
46
|
-
|
47
|
+
"prevent accidental loss. NOTE: It is up to the user to periodically clean up files."
|
47
48
|
|
48
49
|
command_description = "Write iteration output to files in the provided directory " \
|
49
|
-
|
50
|
+
"rather than the current working directory. Can be used along with the timestamp flag."
|
50
51
|
option :d, :dir, command_description, argument: :required
|
51
52
|
|
52
53
|
flag :s, "stop-fast", "Stop when an iteration reports a failure."
|
@@ -71,7 +72,7 @@ end
|
|
71
72
|
# rubocop:enable Metrics/BlockLength
|
72
73
|
|
73
74
|
begin
|
74
|
-
command.run(
|
75
|
+
command.run(ArgumentsHelper.arguments)
|
75
76
|
exit 0
|
76
77
|
rescue RspecN::BadOption => e
|
77
78
|
warn e.message.colorize(:red)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
class ArgumentsHelper
|
4
|
+
class << self
|
5
|
+
def arguments
|
6
|
+
if File.exist?(".rspec_n") && no_options_in_arguments?
|
7
|
+
options = read_options_from_file
|
8
|
+
if options.any?
|
9
|
+
print "Reading options from `.rspec_n` file\n"
|
10
|
+
return ARGV + options
|
11
|
+
end
|
12
|
+
end
|
13
|
+
ARGV
|
14
|
+
end
|
15
|
+
|
16
|
+
# Read arguments from the config file only if no arguments are provided by user
|
17
|
+
def no_options_in_arguments?
|
18
|
+
ARGV.grep(/^-/).empty? # Match args that start with - (or --). Those are the options.
|
19
|
+
end
|
20
|
+
|
21
|
+
# Options can be listed on a single line in the config file, or listed on separate lines.
|
22
|
+
def read_options_from_file
|
23
|
+
Shellwords.shellwords File.read(".rspec_n").to_s.gsub(/\n|\r\n/, " ")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/rspec_n/runner.rb
CHANGED
data/lib/rspec_n/version.rb
CHANGED
data/rspec_n.gemspec
CHANGED
@@ -2,7 +2,6 @@ lib = File.expand_path("lib", __dir__)
|
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require "rspec_n/version"
|
4
4
|
|
5
|
-
# rubocop:disable Metrics/BlockLength
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "rspec_n"
|
8
7
|
spec.version = RspecN::VERSION
|
@@ -22,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
22
21
|
spec.metadata["changelog_uri"] = "https://github.com/roberts1000/rspec_n/blob/master/CHANGELOG.md"
|
23
22
|
else
|
24
23
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
-
|
24
|
+
"public gem pushes."
|
26
25
|
end
|
27
26
|
|
28
27
|
# Specify which files should be added to the gem when it is released.
|
@@ -33,15 +32,8 @@ Gem::Specification.new do |spec|
|
|
33
32
|
spec.bindir = "exe"
|
34
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
34
|
spec.require_paths = ["lib"]
|
36
|
-
spec.required_ruby_version = '>=
|
35
|
+
spec.required_ruby_version = '>= 3.0'
|
37
36
|
|
38
|
-
spec.
|
39
|
-
spec.add_development_dependency "pry", "~> 0.14.0"
|
40
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
41
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
-
spec.add_development_dependency "rubocop_plus", "~> 2.0"
|
43
|
-
|
44
|
-
spec.add_dependency "colorize", "~> 0.8.0"
|
37
|
+
spec.add_dependency "colorize", "~> 1.1.0"
|
45
38
|
spec.add_dependency "cri", "~> 2.15.3"
|
46
39
|
end
|
47
|
-
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,99 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- roberts1000
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.14.0
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.14.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '13.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '13.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop_plus
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.0'
|
83
13
|
- !ruby/object:Gem::Dependency
|
84
14
|
name: colorize
|
85
15
|
requirement: !ruby/object:Gem::Requirement
|
86
16
|
requirements:
|
87
17
|
- - "~>"
|
88
18
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
19
|
+
version: 1.1.0
|
90
20
|
type: :runtime
|
91
21
|
prerelease: false
|
92
22
|
version_requirements: !ruby/object:Gem::Requirement
|
93
23
|
requirements:
|
94
24
|
- - "~>"
|
95
25
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
26
|
+
version: 1.1.0
|
97
27
|
- !ruby/object:Gem::Dependency
|
98
28
|
name: cri
|
99
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,10 +46,11 @@ executables:
|
|
116
46
|
extensions: []
|
117
47
|
extra_rdoc_files: []
|
118
48
|
files:
|
49
|
+
- ".github/pull_request_template.md"
|
50
|
+
- ".github/workflows/check_pull_request.yml"
|
119
51
|
- ".gitignore"
|
120
52
|
- ".rspec"
|
121
53
|
- ".rubocop.yml"
|
122
|
-
- ".travis.yml"
|
123
54
|
- CHANGELOG.md
|
124
55
|
- Gemfile
|
125
56
|
- LICENSE.md
|
@@ -133,6 +64,7 @@ files:
|
|
133
64
|
- lib/rspec_n/errors/bad_option.rb
|
134
65
|
- lib/rspec_n/formatters/file_formatter.rb
|
135
66
|
- lib/rspec_n/formatters/table_formatter.rb
|
67
|
+
- lib/rspec_n/helpers/arguments_helper.rb
|
136
68
|
- lib/rspec_n/helpers/core_ext/array.rb
|
137
69
|
- lib/rspec_n/helpers/core_ext/string.rb
|
138
70
|
- lib/rspec_n/helpers/time_helpers.rb
|
@@ -156,14 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
88
|
requirements:
|
157
89
|
- - ">="
|
158
90
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
91
|
+
version: '3.0'
|
160
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
93
|
requirements:
|
162
94
|
- - ">="
|
163
95
|
- !ruby/object:Gem::Version
|
164
96
|
version: '0'
|
165
97
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.5.6
|
167
99
|
signing_key:
|
168
100
|
specification_version: 4
|
169
101
|
summary: A ruby gem that runs RSpec N times.
|
data/.travis.yml
DELETED