An RSpec minor mode for Emacs
Emacs Lisp
Pull request Compare This branch is 8 commits ahead, 120 commits behind pezra:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Emacs RSpec Mode

RSpec mode provides some convenience functions for dealing with RSpec.


You can install via ELPA, or manually by downloading rspec-mode and adding the following to your init file:

(add-to-list 'load-path "/path/to/rspec-mode")
(require 'rspec-mode)

Provided you have yasnippet installed, you can load the snippets:

(eval-after-load 'rspec-mode

(This isn't done automatically to avoid conflicts with snippets you may already have set up.)


If rspec-mode is installed properly, it will be started automatically when ruby-mode is started.

See rspec-mode.el for further usage.



If you use ZSH and RVM, you may encounter problems running the specs. It may be so that an older version of Ruby, than the one you specified in .rvmrc, is used. This is because ZSH runs a small script each time a shell is created, which modifies the $PATH. The problem is that it prepends some default paths, such as /usr/bin, which contains another ruby binary.

What you can do to solve this is to use BASH for running the specs. This piece of code does the job:

(defadvice rspec-compile (around rspec-compile-around)
  "Use BASH shell for running the specs because of ZSH issues."
  (let ((shell-file-name "/bin/bash"))

(ad-activate 'rspec-compile)


Love RSpec and Emacs? Great, help out by contributing. The easiest way to contribute is to checkout the git project, make a change and then submit a pull request.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Update the version and changelog in the header of rspec-mode.el to reflect the change.
  • Send me a pull request. Bonus points for topic branches.