Using RSpec in Atom

August 27, 2015

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.

Rails testing made simple

Learn to test Rails apps the way I learned, building up tests step-by-step, in Everyday Rails Testing with RSpec. Expanded to include exclusive content and a complete sample Rails application. Learn more »

blog comments powered by Disqus