rspec-rerun 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 53e04e1642d972254feb945956ce9ae830594e5f
4
- data.tar.gz: f266c90c4b476c4ac2edbaddeff61cc7a4a28c3e
2
+ SHA256:
3
+ metadata.gz: dd300aa92d492318d4b247fdf6d8cfe55c77999788140866212c8c2824ac67fc
4
+ data.tar.gz: 276d6f0f5a92ea4976fffb89bbb4210ed21f3e8b8014a6a69f62527b6b403ce3
5
5
  SHA512:
6
- metadata.gz: b7c09c26aa3c62a1c471c3fe29e581133745dbb003f31c404b04fcbb563023d57bdedd80ca1da35b16ac040e7d49dc85ad9c2396bb67a8e202023f8fcbcf7732
7
- data.tar.gz: b26726a8047f0d9846c547ad841a2b3000e415fd17ae78a987e75d6b31204ee3656c99b88f635ef16b8fa1202ba86ab546077c14c88613b3990a8ceed160074c
6
+ metadata.gz: 2f9f3e70094ce8427627fe6a72727d3ef5a512caa9f329160165679312cb8507f85c66fe5463ca3b2af062cd8475af2f2ac0b05380420532a25c9514e64931a8
7
+ data.tar.gz: 607ceeb93d4de09569fb66d72105af58a0463f2b7975dad7836b78bc2cc2560e50d5db53371477ccc8ac7556f64386df8b8f42ed8cd202e842c8403b4924d967
data/README.md CHANGED
@@ -1,43 +1,47 @@
1
1
  ![rspec-rerun](https://raw.github.com/dblock/rspec-rerun/master/rspec-rerun.png)
2
2
 
3
- [![Gem Version](http://img.shields.io/gem/v/rspec-rerun.svg)](http://badge.fury.io/rb/rspec-rerun)
4
- [![Build Status](http://img.shields.io/travis/dblock/rspec-rerun.svg)](https://travis-ci.org/dblock/rspec-rerun)
5
- [![Dependency Status](https://gemnasium.com/dblock/rspec-rerun.svg)](https://gemnasium.com/dblock/rspec-rerun)
6
- [![Code Climate](https://codeclimate.com/github/dblock/rspec-rerun.svg)](https://codeclimate.com/github/dblock/rspec-rerun)
3
+ [![Gem Version](https://badge.fury.io/rb/rspec-rerun.svg)](https://badge.fury.io/rb/rspec-rerun) [![Test](https://github.com/dblock/rspec-rerun/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/dblock/rspec-rerun/actions/workflows/test.yml)
7
4
 
8
- **rspec-rerun** reruns failed RSpec examples (for brittle tests).
5
+ **rspec-rerun** reruns failed RSpec examples (for brittle tests).
9
6
 
10
7
  It writes failed examples to the file `rspec.failures` and feeds these back to RSpec via `-e`.
11
8
 
12
- Usage
13
- -----
14
- (For RSpec 2 use version '~> 0.3.1'. )
9
+ ## Installation
15
10
 
16
- ``` ruby
11
+ Add rspec-rerun to your Gemfile. For RSpec 2, use version `~> 0.3.1`.
12
+
13
+ ```ruby
17
14
  # Gemfile
18
15
  group :development, :test do
19
16
  gem 'rspec-rerun'
20
17
  end
21
18
  ```
22
19
 
20
+ ## Usage
21
+
22
+ Load the tasks in your Rakefile.
23
+
23
24
  ```ruby
24
25
  # Rakefile
25
26
  require 'rspec-rerun/tasks'
26
27
  task default: 'rspec-rerun:spec'
27
28
  ```
28
29
 
30
+ Ignore the failures file.
31
+
29
32
  ```bash
30
33
  echo rspec.failures >> .gitignore
31
34
  ```
32
35
 
33
36
  Run `rake` or `rake rspec-rerun:spec`. Failed examples will be rerun automatically.
34
37
 
35
- Parameters
36
- ----------
38
+ ## Configuration
37
39
 
38
40
  The `rspec-rerun:spec` task accepts the following parameters:
39
41
 
40
- * `retry_count`: number of retries, defaults to 1, also available by setting
42
+ * `retry_count`: number of retries, defaults to 1
43
+
44
+ For example, `rake rspec-rerun:spec[3]`. Zsh users should use `noglob` or quote the task name: `rake 'rspec-rerun:spec[3]'`.
41
45
 
42
46
  You can set the following global environment variables:
43
47
 
@@ -46,19 +50,16 @@ You can set the following global environment variables:
46
50
  * `RSPEC_RERUN_TAG`: only execute the tag specified
47
51
  * `RSPEC_RERUN_VERBOSE`: if 'false', don't show the rspec command invoked by Rake
48
52
 
49
- History
50
- -------
53
+ ## History
51
54
 
52
- Rerunning failed specs has been a long requested feature [#456](https://github.com/rspec/rspec-core/issues/456) in [RSpec](https://github.com/rspec/rspec-core/). A viable approach was suggested in [#596](https://github.com/rspec/rspec-core/pull/596). The infrastructure from that pull request was merged and released with rspec-core 2.11, which enabled re-running specs outside of RSpec, as described in [our blog post](http://artsy.github.com/blog/2012/05/15/how-to-organize-over-3000-rspec-specs-and-retry-test-failures/). This gem has evolved from it.
55
+ Rerunning failed specs has been a long requested feature [#456](https://github.com/rspec/rspec-core/issues/456) in [RSpec](https://github.com/rspec/rspec-core/). A viable approach was suggested in [#596](https://github.com/rspec/rspec-core/pull/596). The infrastructure from that pull request was merged and released with rspec-core 2.11, which enabled re-running specs outside of RSpec, as described in [our blog post](https://artsy.github.io/blog/2012/05/15/how-to-organize-over-3000-rspec-specs-and-retry-test-failures/). This gem has evolved from it.
53
56
 
54
- Contributing
55
- ------------
57
+ ## Contributing
56
58
 
57
- See [CONTRIBUTING](CONTRIBUTING.md).
59
+ See [CONTRIBUTING](CONTRIBUTING.md), [CHANGELOG](CHANGELOG.md), [UPGRADING](UPGRADING.md), and [RELEASING](RELEASING.md).
58
60
 
59
- Copyright and License
60
- ---------------------
61
+ ## Copyright and License
61
62
 
62
63
  MIT License, see [LICENSE](LICENSE.md) for details.
63
64
 
64
- (c) 2012-2015 [Artsy Inc.](http://artsy.github.com), [Daniel Doubrovkine](https://github.com/dblock) and [Contributors](https://github.com/dblock/rspec-rerun/blob/master/CHANGELOG.md)
65
+ (c) 2012-2015 [Artsy Inc.](https://artsy.github.io), [Daniel Doubrovkine](https://github.com/dblock) and [Contributors](https://github.com/dblock/rspec-rerun/blob/master/CHANGELOG.md)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core'
4
+ require 'rspec-rerun/formatter'
5
+
6
+ # Records failing examples with RSpec::Rerun::Formatter without passing it with --format, so that formatters given in
7
+ # SPEC_OPTS and a default_formatter set in RSpec.configure keep working. RSpec adds its default formatter only when no
8
+ # formatter was given, and --format in SPEC_OPTS replaces the formatters on the command line.
9
+ RSpec.configure do |config|
10
+ config.before(:suite) do
11
+ config.add_formatter(RSpec::Rerun::Formatter) unless config.formatters.any?(RSpec::Rerun::Formatter)
12
+ end
13
+ end
@@ -8,8 +8,7 @@ module RSpec
8
8
  def rspec_options(args, spec_files = nil)
9
9
  options = [
10
10
  spec_files,
11
- '--require', 'rspec-rerun/formatter',
12
- '--format', 'RSpec::Rerun::Formatter',
11
+ '--require', 'rspec-rerun/register',
13
12
  *dot_rspec_options
14
13
  ].compact.flatten
15
14
  if args[:tag]
@@ -49,6 +48,15 @@ module RSpec
49
48
  File.read(RSpec::Rerun::Formatter::FILENAME).split
50
49
  end
51
50
 
51
+ def check_failures_recorded!(exit_status)
52
+ return if File.exist?(RSpec::Rerun::Formatter::FILENAME)
53
+
54
+ fail "RSpec failed with exit code #{exit_status} without recording failed examples in " \
55
+ "#{RSpec::Rerun::Formatter::FILENAME}, so there is nothing to re-run. This happens when RSpec fails " \
56
+ 'outside of examples, for example on a load error or when an at_exit hook, such as a SimpleCov ' \
57
+ 'minimum coverage check, changes the exit code.'
58
+ end
59
+
52
60
  def failed_count
53
61
  failing_specs.count
54
62
  end
@@ -69,14 +77,12 @@ module RSpec
69
77
 
70
78
  def dot_rspec_options
71
79
  dot_rspec_file = ['.rspec', File.expand_path('~/.rspec')].detect { |f| File.exist?(f) }
72
- options = if dot_rspec_file
80
+ if dot_rspec_file
73
81
  file_contents = File.read(dot_rspec_file)
74
82
  file_contents.split(/\n+/).map(&:shellsplit).flatten
75
83
  else
76
84
  []
77
85
  end
78
- options.concat ['--format', 'progress'] unless options.include?('--format')
79
- options
80
86
  end
81
87
  end
82
88
  end
@@ -111,6 +117,7 @@ task 'rspec-rerun:spec' do |_t, args|
111
117
  RSpec::Rerun::Tasks.run(parsed_args)
112
118
 
113
119
  until $?.success? || retry_count == 0
120
+ RSpec::Rerun::Tasks.check_failures_recorded!($?.exitstatus)
114
121
  retry_count -= 1
115
122
  msg = RSpec::Rerun::Tasks.failure_message
116
123
  msg += ", re-running, #{retry_count} #{retry_count == 1 ? 'retry' : 'retries'} left" if retry_count > 0
@@ -119,6 +126,7 @@ task 'rspec-rerun:spec' do |_t, args|
119
126
  end
120
127
 
121
128
  unless $?.success?
129
+ RSpec::Rerun::Tasks.check_failures_recorded!($?.exitstatus)
122
130
  $stderr.puts RSpec::Rerun::Tasks.failure_message
123
131
  failed_count = RSpec::Rerun::Tasks.failed_count
124
132
  fail "#{failed_count} failure#{failed_count == 1 ? '' : 's'}"
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Rerun
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2026-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,35 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 0.31.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 0.31.0
69
- - !ruby/object:Gem::Dependency
70
- name: bump
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- description:
55
+ description:
84
56
  email: dblock@dblock.org
85
57
  executables: []
86
58
  extensions: []
@@ -88,13 +60,14 @@ extra_rdoc_files: []
88
60
  files:
89
61
  - README.md
90
62
  - lib/rspec-rerun/formatter.rb
63
+ - lib/rspec-rerun/register.rb
91
64
  - lib/rspec-rerun/tasks.rb
92
65
  - lib/rspec-rerun/version.rb
93
66
  homepage: https://github.com/dblock/rspec-rerun
94
67
  licenses:
95
68
  - MIT
96
69
  metadata: {}
97
- post_install_message:
70
+ post_install_message:
98
71
  rdoc_options: []
99
72
  require_paths:
100
73
  - lib
@@ -109,9 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
82
  - !ruby/object:Gem::Version
110
83
  version: '0'
111
84
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.2.2
114
- signing_key:
85
+ rubygems_version: 3.5.22
86
+ signing_key:
115
87
  specification_version: 4
116
88
  summary: Re-run failed RSpec tests.
117
89
  test_files: []