Everyday Rails

Using RSpec in Atom

By Aaron Sumner, August 27, 2015. File under: .

I’ve been using Atom as my primary code editor since June. My favorite feature is how easy it is to customize the editing environment with tools we know as web developers, then share those customizations with others through Atom’s packages system. My first contribution to the Atom ecosystem is atom-everydayrails-rspec, a collection of snippets for writing RSpec tests–specifically, some shortcuts for spec organization, Capybara, expectations, and some Factory Girl. If you’ve read my book on Rails testing, these should all look familiar.

The package is intentionally light on features. I’ve been adding snippets as I’ve needed them–so if a snippet is missing, it may just be that I haven’t written a spec lately that needed it. I also still prefer to run specs in a terminal window, though there are other Atom packages for those who’d prefer to stay inside the editor.

If you check it out, please let me know what you think. If you’ve got an idea for a snippet, pull requests are welcome!

Other RSpec packages for Atom

If you are interested in running your specs from inside Atom, I suggest checking out Felipe Coury’s atom-rspec package. It’s a simple runner that lets you choose from running all specs in a file, only the spec at the editor’s current line, or your entire suite.

Finally, there’s language-rspec, a port of TextMate’s extensive RSpec plugin, and capybara-snippets, which at present has some snippets that the Everyday Rails package is missing.

What are your favorite Atom packages and hacks? Please share by adding a comment.

Photo: Cropped version of cyclotron by Robert Couse-Baker.

Discussion

Follow along on on Mastodon, Facebook, or Bluesky to keep up-to-date with my latest posts. Better yet, subscribe to my newsletter for updates from Everyday Rails, book picks, and other thoughts and ideas that didn't quite fit here.
Buy Me A Coffee

Test with confidence!

If you liked my series on practical advice for adding reliable tests to your Rails apps, check out the expanded ebook version. Lots of additional, exclusive content and a complete sample Rails application.

Newsletter

Ruby on Rails news and tips, and other ideas and surprises from Aaron at Everyday Rails. Delivered to your inbox on no particular set schedule.