Skip to content

Commit d3954df

Browse files
committed
Quote shell characters in "-n" argument to test runner
Resolves: #599
1 parent 2fba790 commit d3954df

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

autoload/rails.vim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,8 +1481,10 @@ function! s:readable_default_rake_task(...) dict abort
14811481
let opts = ''
14821482
if test ==# self.name()
14831483
let method = self.app().file(test).last_method(lnum)
1484-
if method =~ '^test_'
1485-
let opts = ' TESTOPTS=-n'.method
1484+
if method =~# '^test_\w*$'
1485+
let opts = ' TESTOPTS=-n' . method
1486+
elseif method =~# '^test_'
1487+
let opts = ' TESTOPTS=-n"' . method . '"'
14861488
endif
14871489
endif
14881490
if self.app().has_rails5()
@@ -1883,8 +1885,10 @@ function! s:RunnerCommand(bang, count, arg) abort
18831885
let compiler = 'rubyunit'
18841886
if a:count > 0
18851887
let method = file.last_method(a:count)
1886-
if method =~ '^test_'
1887-
let extra = ' -n'.method
1888+
if method =~# '^test_\w*$'
1889+
let extra = ' -n' . method
1890+
elseif method =~# '^test_'
1891+
let extra = ' -n"' . method . '"'
18881892
else
18891893
let extra = ''
18901894
endif

0 commit comments

Comments
 (0)