mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 04:52:29 +08:00
* Move FindRailsRoot() to more general location * Add rails_best_practices handler (resolves #655) * Update documentation for rails_best_practices Also add brakeman to *ale* documentation. * rails_best_practices: allow overriding the executable * rails_best_practices: format help correctly * rails_best_practices: capture tool output on Windows
This commit is contained in:
50
test/handler/test_rails_best_practices_handler.vader
Normal file
50
test/handler/test_rails_best_practices_handler.vader
Normal file
@@ -0,0 +1,50 @@
|
||||
Before:
|
||||
" Switch to the test rails directory.
|
||||
let b:path = getcwd()
|
||||
silent! cd /testplugin/test/handler
|
||||
cd ../ruby_fixtures/valid_rails_app/app/models
|
||||
|
||||
runtime ale_linters/ruby/rails_best_practices.vim
|
||||
|
||||
After:
|
||||
" Switch back to whatever directory it was that we started on.
|
||||
silent! 'cd ' . fnameescape(b:path)
|
||||
unlet! b:path
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The rails_best_practices handler should parse JSON correctly):
|
||||
silent file! thing.rb
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'text': 'use local variable',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 10,
|
||||
\ 'text': 'other advice',
|
||||
\ 'type': 'W',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#ruby#rails_best_practices#Handle(bufnr(''), [
|
||||
\ '[',
|
||||
\ '{',
|
||||
\ '"message": "use local variable",',
|
||||
\ '"line_number": "5",',
|
||||
\ '"filename": "/testplugin/test/ruby_fixtures/valid_rails_app/app/models/thing.rb"',
|
||||
\ '},{',
|
||||
\ '"message": "other advice",',
|
||||
\ '"line_number": "10",',
|
||||
\ '"filename": "/testplugin/test/ruby_fixtures/valid_rails_app/app/models/thing.rb"',
|
||||
\ '}',
|
||||
\ ']'
|
||||
\ ])
|
||||
|
||||
Execute(The rails_best_practices handler should parse JSON correctly when there is no output from the tool):
|
||||
AssertEqual
|
||||
\ [],
|
||||
\ ale_linters#ruby#rails_best_practices#Handle(347, [
|
||||
\ ])
|
||||
Reference in New Issue
Block a user