Skip to content

Commit

Permalink
Pass flags in TESTOPTS when using spring
Browse files Browse the repository at this point in the history
  • Loading branch information
leppert committed Oct 15, 2015
1 parent 3fc4efd commit 519c869
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions minitest.el
Expand Up @@ -107,6 +107,11 @@ The current directory is assumed to be the project's root otherwise."
file-name)
(error "Buffer is not visiting a file"))))

(defun minitest--test-name-flag (test-name)
(let ((flag (format "-n/test_%s/" test-name)))
(cond (minitest-use-spring (concat "TESTOPTS=" flag))
(t flag))))

(defun minitest--extract-str ()
(save-excursion
(save-restriction
Expand Down Expand Up @@ -136,8 +141,7 @@ The current directory is assumed to be the project's root otherwise."
(if (minitest--extract-str)
(let* ((str (match-string 1))
(post_command (replace-regexp-in-string " " "_" str)))
(minitest--file-command
(format "-n/test_%s/" post_command)))
(minitest--file-command (minitest--test-name-flag post_command)))
(error "No test found. Make sure you are on a file that has `def test_foo` or `test \"foo\"`")))

(defun minitest-rerun ()
Expand Down

0 comments on commit 519c869

Please sign in to comment.