Skip to content

Instantly share code, notes, and snippets.

@dotemacs
Created March 15, 2012 15:16
Show Gist options
  • Save dotemacs/2044740 to your computer and use it in GitHub Desktop.
Save dotemacs/2044740 to your computer and use it in GitHub Desktop.
(defun run-this-spec ()
"take the current buffer, if it's a RSpec example, switch to
eshell to run it"
(interactive)
(if (string-match "_spec\\.rb$" (buffer-file-name))
(let* ((current-buffer (buffer-file-name))
(path-to-the-spec
(replace-regexp-in-string (rinari-root) "" current-buffer)))
(progn
(eshell)
(end-of-buffer)
(insert (concat "rspec " path-to-the-spec))))
(message "not a spec file")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment