Skip to content

Commit ea13795

Browse files
committed
Teach :Rfunctionaltest about spec/mailers
1 parent ff5f552 commit ea13795

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

autoload/rails.vim

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,7 @@ function! s:functionaltestList(A,L,P)
22542254
endif
22552255
if rails#app().has('spec')
22562256
let found += rails#app().relglob("spec/controllers/","**/*","_spec.rb")
2257+
let found += rails#app().relglob("spec/mailers/","**/*","_spec.rb")
22572258
endif
22582259
return s:autocamelize(found,a:A)
22592260
endfunction
@@ -2657,21 +2658,21 @@ function! s:functionaltestEdit(cmd,...)
26572658
else
26582659
let cmd = s:findcmdfor(a:cmd)
26592660
endif
2660-
let mapping = {'test': ['test/functional/','_test.rb'], 'spec': ['spec/controllers/','_spec.rb']}
2661+
let mapping = {'test': [['test/functional/'],['_test.rb','_controller_test.rb']], 'spec': [['spec/controllers/','spec/mailers/'],['_spec.rb','_controller_spec.rb']]}
26612662
let tests = map(filter(rails#app().test_suites(),'has_key(mapping,v:val)'),'get(mapping,v:val)')
26622663
if empty(tests)
26632664
let tests = [mapping[tests]]
26642665
endif
2665-
for [prefix, suffix] in tests
2666-
if rails#app().has_file(prefix.f.suffix)
2667-
return s:findedit(cmd,prefix.f.suffix.jump)
2668-
elseif rails#app().has_file(prefix.f.'_controller'.suffix)
2669-
return s:findedit(cmd,prefix.f.'_controller'.suffix.jump)
2670-
elseif rails#app().has_file(prefix.f.'_api'.suffix)
2671-
return s:findedit(cmd,prefix.f.'_api'.suffix.jump)
2672-
endif
2666+
for [prefixes, suffixes] in tests
2667+
for prefix in prefixes
2668+
for suffix in suffixes
2669+
if rails#app().has_file(prefix.f.suffix)
2670+
return s:findedit(cmd,prefix.f.suffix.jump)
2671+
endif
2672+
endfor
2673+
endfor
26732674
endfor
2674-
return s:EditSimpleRb(a:cmd,"functionaltest",f.jump,tests[0][0],tests[0][1],1)
2675+
return s:EditSimpleRb(a:cmd,"functionaltest",f.jump,tests[0][0][0],tests[0][1][0],1)
26752676
endfunction
26762677

26772678
function! s:integrationtestEdit(cmd,...)

0 commit comments

Comments
 (0)