diff options
author | w0rp <devw0rp@gmail.com> | 2017-07-27 00:45:25 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-07-27 00:45:25 +0100 |
commit | fa33faad9ed6da220394bd2abec2e1bdcd19edba (patch) | |
tree | 288fa6a1f8d2231d3e7b3b8e2915730906d6920e /test/handler/test_rails_best_practices_handler.vader | |
parent | db4d68eae75c071b2a6521fe8587102f5b781efe (diff) | |
download | ale-fa33faad9ed6da220394bd2abec2e1bdcd19edba.zip |
#810 - Handle output which is not JSON in many linters
Diffstat (limited to 'test/handler/test_rails_best_practices_handler.vader')
-rw-r--r-- | test/handler/test_rails_best_practices_handler.vader | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/handler/test_rails_best_practices_handler.vader b/test/handler/test_rails_best_practices_handler.vader index 037d2527..11875cbd 100644 --- a/test/handler/test_rails_best_practices_handler.vader +++ b/test/handler/test_rails_best_practices_handler.vader @@ -1,20 +1,15 @@ Before: - " Switch to the test rails directory. - let b:path = getcwd() - silent! cd /testplugin/test/handler - cd ../ruby_fixtures/valid_rails_app/app/models + call ale#test#SetDirectory('/testplugin/test/handler') + cd .. - runtime ale_linters/ruby/rails_best_practices.vim + 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() + call ale#test#RestoreDirectory() + call ale#linter#Reset() Execute(The rails_best_practices handler should parse JSON correctly): - silent file! thing.rb + call ale#test#SetFilename('ruby_fixtures/valid_rails_app/app/models/thing.rb') AssertEqual \ [ @@ -34,11 +29,11 @@ Execute(The rails_best_practices handler should parse JSON correctly): \ '{', \ '"message": "use local variable",', \ '"line_number": "5",', - \ '"filename": "/testplugin/test/ruby_fixtures/valid_rails_app/app/models/thing.rb"', + \ '"filename": "' . g:dir . '/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"', + \ '"filename": "' . g:dir . '/ruby_fixtures/valid_rails_app/app/models/thing.rb"', \ '}', \ ']' \ ]) @@ -48,3 +43,10 @@ Execute(The rails_best_practices handler should parse JSON correctly when there \ [], \ ale_linters#ruby#rails_best_practices#Handle(347, [ \ ]) + +Execute(The rails_best_practices handler should handle garbage output): + AssertEqual + \ [], + \ ale_linters#ruby#rails_best_practices#Handle(347, [ + \ 'No such command in 2.4.1 of ruby', + \ ]) |