Skip to content

Commit e6d2536

Browse files
committed
Integrate test alternates into projections
1 parent 582883d commit e6d2536

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

autoload/rails.vim

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,25 +3358,6 @@ function! s:readable_alternate_candidates(...) dict abort
33583358
return ['db/seeds.rb']
33593359
elseif f ==# 'db/seeds.rb'
33603360
return ['db/schema.rb', 'db/structure.sql', 'db/'.s:environment().'_structure.sql']
3361-
elseif self.type_name('test')
3362-
let app_file = s:sub(s:sub(f, '<test/', 'app/'), '_test\.rb$', '.rb')
3363-
if app_file =~# '\<app/lib/'
3364-
return [s:sub(app_file,'<app/lib/','lib/')]
3365-
elseif app_file =~# '\<app/unit/helpers/'
3366-
return [s:sub(app_file,'<app/unit/helpers/','app/helpers/')]
3367-
elseif app_file =~# '\<app/functional/.*_controller\.rb'
3368-
return [s:sub(app_file,'<app/functional/','app/controllers/')]
3369-
elseif app_file =~# '\<app/unit/'
3370-
return [s:sub(app_file,'<app/unit/','app/models/'),
3371-
\ s:sub(app_file,'<app/unit/','lib/'),
3372-
\ app_file]
3373-
elseif app_file =~# '\<app/functional'
3374-
return [s:sub(file, '\<app/functional/', 'app/controllers/'),
3375-
\ s:sub(file, '\<app/functional/', 'app/mailers/'),
3376-
\ app_file]
3377-
else
3378-
return [app_file]
3379-
endif
33803361
elseif self.type_name('spec-view')
33813362
return [s:sub(s:sub(f,'<spec/','app/'),'_spec\.rb$','')]
33823363
elseif self.type_name('spec-lib')
@@ -4633,6 +4614,9 @@ let s:has_projections = {
46334614
\ "spec/spec_helper.rb": {"type": "integration test"}
46344615
\ },
46354616
\ "test": {
4617+
\ "test/*_test.rb": {
4618+
\ "alternate": "app/{}.rb"
4619+
\ },
46364620
\ "test/controllers/*_test.rb": {
46374621
\ "template": [
46384622
\ "require 'test_helper'",
@@ -4643,6 +4627,7 @@ let s:has_projections = {
46434627
\ "type": "functional test"
46444628
\ },
46454629
\ "test/functional/*_test.rb": {
4630+
\ "alternate": ["app/controllers/{}.rb", "app/mailers/{}.rb"],
46464631
\ "template": [
46474632
\ "require 'test_helper'",
46484633
\ "",
@@ -4669,7 +4654,10 @@ let s:has_projections = {
46694654
\ ],
46704655
\ "type": "integration test"
46714656
\ },
4672-
\ "test/mailers/": {
4657+
\ "test/lib/*_test.rb": {
4658+
\ "alternate": "lib/{}.rb",
4659+
\ }
4660+
\ "test/mailers/*_test.rb": {
46734661
\ "affinity": "model",
46744662
\ "template": [
46754663
\ "require 'test_helper'",
@@ -4692,13 +4680,18 @@ let s:has_projections = {
46924680
\ "test/test_helper.rb": {"type": "integration test"},
46934681
\ "test/unit/*_test.rb": {
46944682
\ "affinity": "model",
4683+
\ "alternate": ["app/models/{}.rb", "lib/{}.rb"],
46954684
\ "template": [
46964685
\ "require 'test_helper'",
46974686
\ "",
46984687
\ "class {camelcase|capitalize|colons}Test < ActiveSupport::TestCase",
46994688
\ "end"
47004689
\ ],
47014690
\ "type": "unit test"
4691+
\ },
4692+
\ "test/unit/helpers/*_helper_test.rb": {
4693+
\ "affinity": "controller",
4694+
\ "alternate": "app/helpers/{}_helper.rb"
47024695
\ }
47034696
\ },
47044697
\ "turnip": {

0 commit comments

Comments
 (0)