ale/test/fixers/test_standardrb_fixer_callb...

52 lines
1.8 KiB
Plaintext
Raw Normal View History

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):
call ale#test#SetFilename('../test-files/ruby/dummy.rb')
AssertEqual
\ {
2021-01-06 02:07:41 +00:00
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
2021-01-06 02:07:41 +00:00
\ . ' --fix --force-exclusion --stdin %s',
\ },
\ ale#fixers#standardrb#Fix(bufnr(''))
Execute(The standardrb callback should include configuration files):
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
AssertEqual
\ {
2021-01-06 02:07:41 +00:00
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
\ . ' --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',
\ },
\ ale#fixers#standardrb#Fix(bufnr(''))
Execute(The standardrb callback should include custom rubocop options):
let g:ale_ruby_standardrb_options = '--except Lint/Debugger'
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
AssertEqual
\ {
2021-01-06 02:07:41 +00:00
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_standardrb_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.standard.yml'))
\ . ' --except Lint/Debugger'
2021-01-06 02:07:41 +00:00
\ . ' --fix --force-exclusion --stdin %s',
\ },
\ ale#fixers#standardrb#Fix(bufnr(''))