You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dot-files/test/handler/test_rails_best_practices_h...

53 lines
1.4 KiB
Plaintext

Before:
call ale#test#SetDirectory('/testplugin/test/handler')
cd ..
runtime ale_linters/ruby/rails_best_practices.vim
After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The rails_best_practices handler should parse JSON correctly):
call ale#test#SetFilename('ruby_fixtures/valid_rails_app/app/models/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": "' . g:dir . '/ruby_fixtures/valid_rails_app/app/models/thing.rb"',
\ '},{',
\ '"message": "other advice",',
\ '"line_number": "10",',
\ '"filename": "' . g:dir . '/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, [
\ ])
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',
\ ])