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