2017-07-12 09:43:47 +00:00
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#SetUpLinterTest('ruby', 'rails_best_practices')
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb')
|
2017-07-12 09:43:47 +00:00
|
|
|
|
2017-10-05 21:31:00 +00:00
|
|
|
let b:args = '--silent -f json'
|
|
|
|
\ . ' --output-file ' . (has('win32') ? '%t' : '/dev/stdout')
|
2021-03-20 22:11:22 +00:00
|
|
|
let b:app_path = ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app')
|
2017-10-05 21:31:00 +00:00
|
|
|
let b:suffix = has('win32') ? '; type %t' : ''
|
|
|
|
|
2017-07-12 09:43:47 +00:00
|
|
|
After:
|
2017-10-05 21:31:00 +00:00
|
|
|
unlet! b:args
|
|
|
|
unlet! b:app_path
|
|
|
|
unlet! b:suffix
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-07-12 09:43:47 +00:00
|
|
|
|
|
|
|
Execute(Executable should default to rails_best_practices):
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'rails_best_practices', ale#Escape('rails_best_practices')
|
2017-10-05 21:31:00 +00:00
|
|
|
\ . ' ' . b:args
|
|
|
|
\ . ' ' . ale#Escape(b:app_path)
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . b:suffix
|
2017-07-12 09:43:47 +00:00
|
|
|
|
|
|
|
Execute(Should be able to set a custom executable):
|
|
|
|
let g:ale_ruby_rails_best_practices_executable = 'bin/rails_best_practices'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'bin/rails_best_practices', ale#Escape('bin/rails_best_practices')
|
2017-10-05 21:31:00 +00:00
|
|
|
\ . ' ' . b:args
|
|
|
|
\ . ' ' . ale#Escape(b:app_path)
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . b:suffix
|
2017-07-12 09:43:47 +00:00
|
|
|
|
|
|
|
Execute(Setting bundle appends 'exec rails_best_practices'):
|
|
|
|
let g:ale_ruby_rails_best_practices_executable = 'path to/bundle'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
|
|
|
\ . ' exec rails_best_practices'
|
2017-10-05 21:31:00 +00:00
|
|
|
\ . ' ' . b:args
|
|
|
|
\ . ' ' . ale#Escape(b:app_path)
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . b:suffix
|
2017-07-12 09:43:47 +00:00
|
|
|
|
|
|
|
Execute(Command callback should be empty when not in a valid Rails app):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/test.rb')
|
2017-07-12 09:43:47 +00:00
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'rails_best_practices', ''
|