2018-12-10 21:02:32 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_ruby_standardrb_executable
|
|
|
|
Save g:ale_ruby_standardrb_options
|
|
|
|
|
|
|
|
" Use an invalid global executable, so we don't match it.
|
|
|
|
let g:ale_ruby_standardrb_executable = 'xxxinvalid'
|
|
|
|
let g:ale_ruby_standardrb_options = ''
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
Execute(The standardrb callback should return the correct default values):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/ruby/dummy.rb')
|
2018-12-10 21:02:32 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
2021-01-06 02:07:41 +00:00
|
|
|
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
|
2021-01-06 02:07:41 +00:00
|
|
|
\ . ' --fix --force-exclusion --stdin %s',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#standardrb#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The standardrb callback should include configuration files):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
|
2018-12-10 21:02:32 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
2021-01-06 02:07:41 +00:00
|
|
|
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
|
2021-03-20 22:11:22 +00:00
|
|
|
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.standard.yml'))
|
2021-01-06 02:07:41 +00:00
|
|
|
\ . ' --fix --force-exclusion --stdin %s',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#standardrb#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The standardrb callback should include custom rubocop options):
|
|
|
|
let g:ale_ruby_standardrb_options = '--except Lint/Debugger'
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
|
2018-12-10 21:02:32 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
2021-01-06 02:07:41 +00:00
|
|
|
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
|
2021-03-20 22:11:22 +00:00
|
|
|
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.standard.yml'))
|
2018-12-10 21:02:32 +00:00
|
|
|
\ . ' --except Lint/Debugger'
|
2021-01-06 02:07:41 +00:00
|
|
|
\ . ' --fix --force-exclusion --stdin %s',
|
2018-12-10 21:02:32 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#standardrb#Fix(bufnr(''))
|