Jump to content

Ruby on Rails: rerun failed minitest tests from iTerm2


Recommended Posts

Scratches an itch I've had for a long time.

 

Automagically combine failed minitest tests into a single command in iTerm2

 

Usage

When you have failed tests in a rails minitest suite using the defer option, e.g.

 

rails test test/models/whatever_test.rb -d

 

you get something like the following out of the box in iTerm2:
 

Failed tests:

rails test test/system/whatever_test.rb:4
rails test test/system/filler_test.rb:135

 

This can be a pain when you have some flaky tests, and in my experience, you'll always have some flakiness with system tests especially. Once you have the workflow installed, just type combinerailstests in Alfred, and the appropriate command to run those failed tests will be built, typed into iTerm2 and run for you, e.g.

 

bin/rails test test/system/whatever_test.rb:4 test/system/filler_test.rb:135 -vd

 

 Assumptions

  • You're using binstubs in your Rails app

 

Download | Source

 

P.S. - Hope I did this right...first workflow I've ever shared.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...