Skip to content

Commit

Permalink
emacs: rspec-command cover more paths
Browse files Browse the repository at this point in the history
  • Loading branch information
bergey committed Feb 7, 2025
1 parent 4da1c01 commit 411765d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion emacs/bergey/bergey-ruby.el
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
(defun bergey/ruby-yank-rspec-command ()
"copy an rspec command which can be run in the shell to run the tests in the current file"
(interactive)
(kill-new (s-replace-regexp "^.*spec/" "bundle exec rspec spec/" (buffer-file-name)))
(let ((prefix (if (s-match "/domains/" (buffer-file-name)) "^\\(.*\\)domains/" "^\\(.*\\)spec/")))
(kill-new (s-replace-regexp prefix "bundle exec rspec " (buffer-file-name) nil nil 1)))
)
(bind-key "C-c r" #'bergey/ruby-yank-rspec-command rspec-mode-map)

Expand Down

0 comments on commit 411765d

Please sign in to comment.