Skip to content

Commit

Permalink
Add vim-test alternatives for Rails request specs
Browse files Browse the repository at this point in the history
This also supports feature and system tests, by defining projections.

tpope/vim-rails#368 (comment)
  • Loading branch information
nickcharlton committed Oct 11, 2019
1 parent e53e672 commit 50d8f85
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions vim/ftplugin/ruby.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
let g:rails_projections = {
\ "app/controllers/*_controller.rb": {
\ "test": [
\ "spec/requests/{}_spec.rb",
\ "spec/features/{}_spec.rb",
\ "spec/system/{}_spec.rb",
\ "spec/controllers/{}_controller_spec.rb",
\ "test/controllers/{}_controller_test.rb"
\ ],
\ "alternate": [
\ "spec/requests/{}_spec.rb",
\ "spec/features/{}_spec.rb",
\ "spec/system/{}_spec.rb",
\ "spec/controllers/{}_controller_spec.rb",
\ "test/controllers/{}_controller_test.rb"
\ ],
\ },
\ "spec/requests/*_spec.rb": {
\ "command": "request",
\ "alternate": "app/controllers/{}_controller.rb",
\ "template": "require 'rails_helper'\n\n" .
\ "RSpec.describe '{}' do\nend",
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "alternate": "app/controllers/{}_controller.rb",
\ "template": "require 'rails_helper'\n\n" .
\ "RSpec.feature '{}' do\nend",
\ },
\ "spec/system/*_spec.rb": {
\ "command": "system",
\ "alternate": "app/controllers/{}_controller.rb",
\ "template": "require 'rails_helper'\n\n" .
\ "RSpec.describe '{}' do\nend",
\ },
\ }

0 comments on commit 50d8f85

Please sign in to comment.