Skip to content

Commit

Permalink
add rails projections for rspec controllers
Browse files Browse the repository at this point in the history
Adds support for rspec `requests/` default directory naming in addition
to `controllers/` and `intergration/`.

Based on tpope/vim-rails#368 (comment)
  • Loading branch information
ShawnAukstak committed Jun 3, 2021
1 parent 89c750d commit fb43d5c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions vim/after/ftplugin/ruby.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ let b:ale_ruby_rubocop_executable = 'bin/rubocop'
" let g:rubycomplete_buffer_loading = 1
" let g:rubycomplete_classes_in_global = 1
" let g:rubycomplete_rails = 1

let g:rails_projections = {
\ "app/controllers/*_controller.rb": {
\ "test": [
\ "spec/requests/{}_spec.rb",
\ "spec/controllers/{}_controller_spec.rb",
\ "test/controllers/{}_controller_test.rb",
\ "test/integration/{}_controller_test.rb",
\ ],
\ "alternate": [
\ "spec/requests/{}_spec.rb",
\ "spec/controllers/{}_controller_spec.rb",
\ "test/controllers/{}_controller_test.rb",
\ "test/integration/{}_controller_test.rb",
\ ],
\ },
\ "spec/requests/*_spec.rb": {
\ "command": "request",
\ "alternate": "app/controllers/{}_controller.rb",
\ "template": "require 'rails_helper'\n\n" .
\ "RSpec.describe '{}' do\nend",
\ },
\ "test/integration/*_test.rb": {
\ "command": "request",
\ "alternate": "app/controllers/{}_controller.rb",
\ "template": "require 'rails_helper'\n\n" .
\ "RSpec.describe '{}' do\nend",
\ },
\ }

0 comments on commit fb43d5c

Please sign in to comment.