mirror of
https://github.com/jbranchaud/til
synced 2026-01-10 10:38:01 +00:00
Add Rerun Only Failures With RSpec as a ruby til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_498 TILs and counting..._
|
_499 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -379,6 +379,7 @@ _498 TILs and counting..._
|
|||||||
- [Rendering ERB](ruby/rendering-erb.md)
|
- [Rendering ERB](ruby/rendering-erb.md)
|
||||||
- [Replace The Current Process With An External Command](ruby/replace-the-current-process-with-an-external-command.md)
|
- [Replace The Current Process With An External Command](ruby/replace-the-current-process-with-an-external-command.md)
|
||||||
- [Require Entire Gemfile In Pry Session](ruby/require-entire-gemfile-in-pry-session.md)
|
- [Require Entire Gemfile In Pry Session](ruby/require-entire-gemfile-in-pry-session.md)
|
||||||
|
- [Rerun Only Failures With RSpec](ruby/rerun-only-failures-with-rspec.md)
|
||||||
- [Returning With Sequel](ruby/returning-with-sequel.md)
|
- [Returning With Sequel](ruby/returning-with-sequel.md)
|
||||||
- [Running A Single MiniTest Example](ruby/running-a-single-minitest-example.md)
|
- [Running A Single MiniTest Example](ruby/running-a-single-minitest-example.md)
|
||||||
- [Safe Navigation Operator](ruby/safe-navigation-operator.md)
|
- [Safe Navigation Operator](ruby/safe-navigation-operator.md)
|
||||||
|
|||||||
26
ruby/rerun-only-failures-with-rspec.md
Normal file
26
ruby/rerun-only-failures-with-rspec.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Rerun Only Failures With RSpec
|
||||||
|
|
||||||
|
After running a big test suite, I may have a bunch of output on the screen
|
||||||
|
including the results of a couple test failures. I like to bring the context
|
||||||
|
of the test failures front and center and make sure they are consistent test
|
||||||
|
failures (not flickering failures). Instead of copying and pasting each
|
||||||
|
failure, I can rerun `rspec` in a way that executes on the test cases that
|
||||||
|
failed.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ rspec --only-failures
|
||||||
|
```
|
||||||
|
|
||||||
|
This feature requires that you set a file for RSpec to persist some state
|
||||||
|
between runs. Do this in the `spec/spec_helper.rb` file. For example:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.example_status_persistence_file_path = "spec/examples.txt"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
See more details
|
||||||
|
[here](https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures).
|
||||||
|
|
||||||
|
h/t Brian Dunn
|
||||||
Reference in New Issue
Block a user