summaryrefslogtreecommitdiff
path: root/test/fixers/test_standardrb_fixer_callback.vader
blob: ff82b8f17a46f15b6c7feb65d47f7b1dfbc3bfaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
  \ {
  \   'process_with': 'ale#fixers#rubocop#PostProcess',
  \   'command': ale#Escape(g:ale_ruby_standardrb_executable)
  \     . ' --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
  \ {
  \   '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'))
  \     . ' --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
  \ {
  \   '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'
  \     . ' --fix --force-exclusion --stdin %s',
  \ },
  \ ale#fixers#standardrb#Fix(bufnr(''))