VSCode Extensions for Faster Testing with Rspec 🛠
Jaye Hernandez

Jaye Hernandez @jayehernandez

About: Full stack dev who likes to keep herself busy by building stuff on the side 🌻

Location:
Manila, PH
Joined:
Jun 18, 2019

VSCode Extensions for Faster Testing with Rspec 🛠

Publish Date: May 24 '20
40 7

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.

  1. Rails Go To Spec by sporto

    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 (Cmd for Mac)

    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 + Y to create the spec file.

  2. Rails Run Specs by Peter Negrei

    I used to get the path of a file/inside/lots/of/folders/sad_spec.rb just 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 (Cmd for 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. 💯

  3. Ruby Test Explorer by Connor Shea

    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.

    Ruby Test Explorer Screenshot
    Image from Connor Shea

    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!

Comments 7 total

  • Vaibhav Khulbe
    Vaibhav KhulbeMay 24, 2020

    Nice post! Haven't used Ruby/Rspec but it's in my bucket list. Will definitely use some of these. Keep writing 😁

    • Jaye Hernandez
      Jaye HernandezMay 24, 2020

      Thanks Vaibhav! Yes, do pick it up sometime, it’s great 💯

  • Raphael Jambalos
    Raphael JambalosMay 25, 2020

    Great post, Jaye! I wish there was something like this in Sublime Text though...

    • Jaye Hernandez
      Jaye HernandezMay 26, 2020

      Thank you! Sublime Text needs to step up their game 🤔

  • Julien Camblan
    Julien CamblanMay 27, 2020

    Very useful, thanks! The second one is kinda life changing actually! 🙏

    • Jaye Hernandez
      Jaye HernandezMay 27, 2020

      Glad to help out! The second one is definitely the best 🔥

  • Thadeu Esteves Jr
    Thadeu Esteves JrMar 9, 2024

    vscode-run-rspec-file give us a lot of shortcuts to run our rspec tests

Add comment