diff --git a/emacs/.emacs.d/config/init-run-command.el b/emacs/.emacs.d/config/init-run-command.el index 6e7c8c3..b19ffa1 100644 --- a/emacs/.emacs.d/config/init-run-command.el +++ b/emacs/.emacs.d/config/init-run-command.el @@ -364,6 +364,18 @@ :working-dir root-dir)) scripts))) + (defun run-command-recipe-rspec () + (when + (and (derived-mode-p 'ruby-mode) + (save-excursion + (goto-char (point-min)) + (re-search-forward "RSpec" nil t))) + (let ((root-dir (or (projectile-project-root) default-directory))) + (list + (list :command-name "test this file" + :command-line (format "rspec %s" (buffer-file-name)) + :working-dir root-dir))))) + :general (leader-map "\"" #'run-command) :custom @@ -386,6 +398,7 @@ run-command-recipe-maven run-command-recipe-cargo run-command-recipe-rake - run-command-recipe-scripts))) + run-command-recipe-scripts + run-command-recipe-rspec))) (provide 'init-run-command)