2017-06-25 19:04:14 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_ruby_rubocop_executable
|
2017-08-10 13:57:30 +00:00
|
|
|
Save g:ale_ruby_rubocop_options
|
2017-06-25 19:04:14 +00:00
|
|
|
|
|
|
|
" Use an invalid global executable, so we don't match it.
|
|
|
|
let g:ale_ruby_rubocop_executable = 'xxxinvalid'
|
2017-08-10 13:57:30 +00:00
|
|
|
let g:ale_ruby_rubocop_options = ''
|
2017-06-25 19:04:14 +00:00
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
2017-06-25 19:04:14 +00:00
|
|
|
silent cd ..
|
|
|
|
silent cd command_callback
|
|
|
|
let g:dir = getcwd()
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
2017-06-25 19:04:14 +00:00
|
|
|
|
|
|
|
Execute(The rubocop callback should return the correct default values):
|
2017-07-06 21:58:14 +00:00
|
|
|
call ale#test#SetFilename('ruby_paths/dummy.rb')
|
2017-06-25 19:04:14 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-06 21:58:14 +00:00
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
2018-10-30 22:18:07 +00:00
|
|
|
\ . ' --auto-correct --force-exclusion %t',
|
2017-07-06 21:58:14 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The rubocop callback should include configuration files):
|
|
|
|
call ale#test#SetFilename('ruby_paths/with_config/dummy.rb')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
2017-12-19 18:23:09 +00:00
|
|
|
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
2018-10-30 22:18:07 +00:00
|
|
|
\ . ' --auto-correct --force-exclusion %t',
|
2017-08-10 13:52:54 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The rubocop callback should include custom rubocop options):
|
|
|
|
let g:ale_ruby_rubocop_options = '--except Lint/Debugger'
|
|
|
|
call ale#test#SetFilename('ruby_paths/with_config/dummy.rb')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
2017-12-19 18:23:09 +00:00
|
|
|
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
2017-08-10 13:57:30 +00:00
|
|
|
\ . ' --except Lint/Debugger'
|
2018-10-30 22:18:07 +00:00
|
|
|
\ . ' --auto-correct --force-exclusion %t',
|
2017-07-06 21:58:14 +00:00
|
|
|
\ },
|
2017-06-25 19:04:14 +00:00
|
|
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|