Let's run through some extensions to improve your workflow if you use Rspec, a testing tool for Ruby!
It’s another one of those VSCode extensions post - I know. But trust me on this one.
If you haven’t heard about Visual Studio Code (VSCode), it’s a text editor by Microsoft. One of the reasons why it's my editor of choice is the ability to install extensions made by fellow developers.
You can actually spend a day just installing and configuring extensions to your liking. Not that I did that. 😅
These three extensions made Test Driven Development (TDD) with Rspec much better. I love the ease of use these offer without sacrificing anything. Writing tests became faster and easier for me to do, I hope these help you out too! Hey that rhymed.
No need to look through your files in the sidebar, or use the search bar to open the spec file. You can jump between code and spec files with one command:
Ctrl + Shift + Y(
If the code file does not exist yet, this creates one for you! Works both ways.
Use case: I often do this at the start of the test writing process. I create the code file first, then press
Cmd + Shift + Yto create the spec file.
I used to get the path of a
file/inside/lots/of/folders/sad_spec.rbjust to type out the test command:
bundle exec rspec file/inside/lots/of/folders/sad_spec.rb.
This extension runs a spec file for you with in one swift command:
Ctrl + Shift + T(
Cmdfor Mac) It works even if you are in the code file as well, which is a pretty nifty feature.
Use case: Probably my most used extension as I use it to run all the tests in one file. Gotta make sure they all pass. 💯
If you're a more visually oriented person, this is the extension you’re looking for. It helps you visualize all the tests in one file, with groupings according to files inside a describe or context block.
You get to see which blocks passed and which failed in an instant, and re-run any of those on their own.
Use case: Great for debugging that one single failing test that you have absolutely no idea why it’s failing when all other 10 tests passed. You can just select that single test (or block of tests) and debug.
This is just a small list, but the impact they have is unmatched.
Do you use any other VSCode Rspec extensions? I’d love to know about them, let’s help each other out!