rspec_n 1.5.0 → 1.6.0
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 +4 -4
- data/.github/pull_request_template.md +3 -0
- data/.github/workflows/check_pull_request.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +7 -0
- data/README.md +42 -30
- data/lib/rspec_n/runner.rb +1 -1
- data/lib/rspec_n/version.rb +1 -1
- data/rspec_n.gemspec +2 -7
- metadata +7 -62
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
|
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
runs-on: ubuntu-latest
|
14
14
|
strategy:
|
15
15
|
matrix:
|
16
|
-
ruby-version: ['
|
16
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3']
|
17
17
|
steps:
|
18
18
|
- uses: actions/checkout@v2
|
19
19
|
- name: Set up Ruby
|
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
runs-on: ubuntu-latest
|
31
31
|
strategy:
|
32
32
|
matrix:
|
33
|
-
ruby-version: ['
|
33
|
+
ruby-version: ['3.0']
|
34
34
|
steps:
|
35
35
|
- uses: actions/checkout@v2
|
36
36
|
- name: Set up Ruby
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,8 +2,17 @@
|
|
2
2
|
|
3
3
|
Issues are tracked at https://github.com/roberts1000/rspec_n/issues. Issues marked as **(Internal)** only affect development.
|
4
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
|
+
|
5
13
|
## 1.5.0 (Aug 28, 2022)
|
6
14
|
|
15
|
+
1. [#53](../../issues/53): Add support for a config file.
|
7
16
|
1. [#87](../../issues/87): Add GitHub action workflow to check pull requests. **(Internal)**
|
8
17
|
1. [#93](../../issues/93): Make Ruby 2.7.0 the min supported Ruby.
|
9
18
|
1. [#97](../../issues/97): Add Ruby 3.1 support.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,15 @@ rspec_n is a Ruby gem that makes it easy to run a project's RSpec test suite N t
|
|
4
4
|
|
5
5
|

|
6
6
|
|
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.
|
15
|
+
|
7
16
|
## Versioning Strategy
|
8
17
|
|
9
18
|
Releases are versioned using [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) with the following caveats:
|
@@ -12,7 +21,7 @@ Releases are versioned using [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html)
|
|
12
21
|
|
13
22
|
## Supported Ruby Versions
|
14
23
|
|
15
|
-
Ruby
|
24
|
+
Ruby 3.0+ is supported.
|
16
25
|
|
17
26
|
## Installation
|
18
27
|
|
@@ -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 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
|
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,13 +45,15 @@ 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
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
|
-
To target specific specs, provide one or more paths. You can do anything you would normally do when
|
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
|
@@ -57,29 +68,7 @@ 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
|
-
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.
|
63
|
-
|
64
|
-
Example file format:
|
65
|
-
|
66
|
-
```
|
67
|
-
--no-file
|
68
|
-
-s
|
69
|
-
--order defined
|
70
|
-
-c "rm -rf tmp && bundle exec rspec"
|
71
|
-
```
|
72
|
-
|
73
|
-
The config file can be multi line or single line.
|
74
|
-
|
75
|
-
#### Automatic Command Selection
|
76
|
-
|
77
|
-
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:
|
78
|
-
|
79
|
-
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`.
|
80
|
-
2. Everything else: `bundle exec rspec`.
|
81
|
-
|
82
|
-
#### Use a Custom Command to Start RSpec
|
71
|
+
### Use a Custom Command to Start RSpec
|
83
72
|
|
84
73
|
Use the `-c` option if you want to specify your own command. The following example deletes the `tmp` folder before starting RSpec:
|
85
74
|
|
@@ -89,20 +78,43 @@ There are a couple points to consider:
|
|
89
78
|
|
90
79
|
1. Wrap your entire command in a single or double quoted string.
|
91
80
|
1. Use `&&` to create compound commands.
|
92
|
-
1.
|
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:
|
93
82
|
|
94
|
-
|
83
|
+
```
|
84
|
+
$ rspec_n 5 -c 'rm -rf tmp && bundle exec rspec' --order defined
|
85
|
+
```
|
86
|
+
|
87
|
+
### Control the File Output
|
95
88
|
|
96
|
-
rspec_n writes output for each iteration to files with the iteration number (`rspec_n_iteration.1`, `rspec_n_iteration.2`, etc...). If you want to disable this, add the `--no-file` option to the command.
|
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.
|
97
90
|
|
98
91
|
$ rspec_n 5 --no-file
|
99
92
|
|
100
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.
|
101
94
|
|
102
|
-
|
95
|
+
### Stop on First Failure
|
103
96
|
|
104
97
|
You can tell rspec_n to abort the first time an iteration fails by using the `-s` flag. All remaining iterations are skipped.
|
105
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
|
+
|
106
118
|
## Understanding the Results
|
107
119
|
|
108
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`.
|
data/lib/rspec_n/runner.rb
CHANGED
data/lib/rspec_n/version.rb
CHANGED
data/rspec_n.gemspec
CHANGED
@@ -32,13 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.bindir = "exe"
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
|
-
spec.required_ruby_version = '>=
|
35
|
+
spec.required_ruby_version = '>= 3.0'
|
36
36
|
|
37
|
-
spec.
|
38
|
-
spec.add_development_dependency "pry", "~> 0.14.0"
|
39
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
40
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
-
|
42
|
-
spec.add_dependency "colorize", "~> 0.8.0"
|
37
|
+
spec.add_dependency "colorize", "~> 1.1.0"
|
43
38
|
spec.add_dependency "cri", "~> 2.15.3"
|
44
39
|
end
|
metadata
CHANGED
@@ -1,85 +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
13
|
- !ruby/object:Gem::Dependency
|
70
14
|
name: colorize
|
71
15
|
requirement: !ruby/object:Gem::Requirement
|
72
16
|
requirements:
|
73
17
|
- - "~>"
|
74
18
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
19
|
+
version: 1.1.0
|
76
20
|
type: :runtime
|
77
21
|
prerelease: false
|
78
22
|
version_requirements: !ruby/object:Gem::Requirement
|
79
23
|
requirements:
|
80
24
|
- - "~>"
|
81
25
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
26
|
+
version: 1.1.0
|
83
27
|
- !ruby/object:Gem::Dependency
|
84
28
|
name: cri
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +46,7 @@ executables:
|
|
102
46
|
extensions: []
|
103
47
|
extra_rdoc_files: []
|
104
48
|
files:
|
49
|
+
- ".github/pull_request_template.md"
|
105
50
|
- ".github/workflows/check_pull_request.yml"
|
106
51
|
- ".gitignore"
|
107
52
|
- ".rspec"
|
@@ -143,14 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
88
|
requirements:
|
144
89
|
- - ">="
|
145
90
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
91
|
+
version: '3.0'
|
147
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
93
|
requirements:
|
149
94
|
- - ">="
|
150
95
|
- !ruby/object:Gem::Version
|
151
96
|
version: '0'
|
152
97
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.5.6
|
154
99
|
signing_key:
|
155
100
|
specification_version: 4
|
156
101
|
summary: A ruby gem that runs RSpec N times.
|