Modern Vim by Drew Neil

Modern Vim by Drew Neil

Author:Drew Neil
Language: eng
Format: epub
Tags: Pragmatic Bookshelf
Publisher: Pragmatic Bookshelf


Re-Running the Most Recent Test Runner

When practicing test-driven development, you’ll switch frequently between the test and implementation files. What if you want to use a test runner command when you don’t have a test file open? That’s where the :TestLast command comes in. You can use this to re-run the test runner that you used most recently.

To try this out, activate the testing-rb project and run the last test by itself:

​=> ​:tablast​

​=> ​:normal G​

​=> ​:TestNearest​

​<= bundle exec rspec spec/homophoner_spec.rb:25

​ ...

The testing-rb directory contains a break-things.diff patch file, which will cause the tests to fail. Apply the patch, then open the implementation file:

​=> ​:!patch lib/homophoner.rb break-things.diff​

​=> ​:edit! lib/homophoner.rb​

In this context, running :TestNearest makes no sense because the active buffer is not a test file. But you can use :TestLast to re-run the last test:

​=> ​:TestLast​

​<= bundle exec rspec spec/homophoner_spec.rb:25

You’ll see some failures this time. If you like a challenge, study the error message and see if you can fix the failing test. (Take a peek inside the break-things.diff file if you want a hint!)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.