Skip to content

Commit 6495d8f

Browse files
committed
:Rintegrationtest goes to integration specs
1 parent b1e9238 commit 6495d8f

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

autoload/rails.vim

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ function! s:Complete_script(ArgLead,CmdLine,P)
15571557
return s:modelList(a:ArgLead,"","")
15581558
elseif target ==# 'migration' || target ==# 'session_migration'
15591559
return s:migrationList(a:ArgLead,"","")
1560-
elseif target ==# 'integration_test' || target ==# 'feature'
1560+
elseif target ==# 'integration_test' || target ==# 'integration_spec' || target ==# 'feature'
15611561
return s:integrationtestList(a:ArgLead,"","")
15621562
elseif target ==# 'observer'
15631563
let observers = s:observerList("","","")
@@ -2032,7 +2032,7 @@ function! s:BufFinderCommands()
20322032
call s:addfilecmds("unittest")
20332033
call s:addfilecmds("functionaltest")
20342034
endif
2035-
if rails#app().has('test') || rails#app().has('cucumber')
2035+
if rails#app().has('test') || rails#app().has('spec') || rails#app().has('cucumber')
20362036
call s:addfilecmds("integrationtest")
20372037
endif
20382038
if rails#app().has('spec')
@@ -2187,14 +2187,20 @@ function! s:functionaltestList(A,L,P)
21872187
endfunction
21882188

21892189
function! s:integrationtestList(A,L,P)
2190+
if a:A =~# '^\u'
2191+
return s:autocamelize(rails#app().relglob("test/integration/","**/*","_test.rb"),a:A)
2192+
endif
21902193
let found = []
21912194
if rails#app().has('test')
2192-
let found += s:autocamelize(rails#app().relglob("test/integration/","**/*","_test.rb"),a:A)
2195+
let found += rails#app().relglob("test/integration/","**/*","_test.rb")
2196+
endif
2197+
if rails#app().has('spec')
2198+
let found += rails#app().relglob("spec/integration/","**/*","_spec.rb")
21932199
endif
21942200
if rails#app().has('cucumber')
2195-
let found += s:completion_filter(rails#app().relglob("features/","**/*",".feature"),a:A)
2201+
let found += rails#app().relglob("features/","**/*",".feature")
21962202
endif
2197-
return found
2203+
return s:completion_filter(found,a:A)
21982204
endfunction
21992205

22002206
function! s:specList(A,L,P)
@@ -2609,11 +2615,7 @@ endfunction
26092615

26102616
function! s:integrationtestEdit(cmd,...)
26112617
if !a:0
2612-
if rails#app().has('cucumber') && !rails#app().has('test')
2613-
return s:EditSimpleRb(a:cmd,"integrationtest","support/env","features/",".rb")
2614-
else
2615-
return s:EditSimpleRb(a:cmd,"integrationtest","test_helper","test/",".rb")
2616-
endif
2618+
return s:EditSimpleRb(a:cmd,"integrationtest","test/test_helper\nfeatures/support/env\nspec/spec_helper","",".rb")
26172619
endif
26182620
let f = rails#underscore(matchstr(a:1,'[^!#:]*'))
26192621
let jump = matchstr(a:1,'[!#:].*')
@@ -2622,7 +2624,7 @@ function! s:integrationtestEdit(cmd,...)
26222624
else
26232625
let cmd = s:findcmdfor(a:cmd)
26242626
endif
2625-
let mapping = {'test': ['test/integration/','_test.rb'], 'cucumber': ['features/','.feature']}
2627+
let mapping = {'test': ['test/integration/','_test.rb'], 'spec': ['spec/integration/','_spec.rb'], 'cucumber': ['features/','.feature']}
26262628
let tests = map(filter(rails#app().test_suites(),'has_key(mapping,v:val)'),'get(mapping,v:val)')
26272629
if empty(tests)
26282630
let tests = [mapping['test']]

doc/rails.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ The following commands are not clearly associated with models or controllers.
506506

507507
*rails-:Rintegrationtest*
508508
:Rintegrationtest [{name}]
509-
Edit the integration test or cucumber feature
510-
specified. With no argument, defaults to editing
511-
test/test_helper.rb.
509+
Edit the integration test, integration spec, or
510+
cucumber feature specified. With no argument,
511+
defaults to editing test/test_helper.rb.
512512

513513
*rails-:Rspec*
514514
:Rspec [{name}] Edit the given spec. With no argument, defaults to

0 commit comments

Comments
 (0)