|
1 | 1 | Before: |
2 | | - Save g:ale_ruby_rubocop_executable |
3 | | - Save g:ale_ruby_rubocop_options |
4 | | - |
5 | | - " Use an invalid global executable, so we don't match it. |
6 | | - let g:ale_ruby_rubocop_executable = 'xxxinvalid' |
7 | | - let g:ale_ruby_rubocop_options = '' |
8 | | - |
9 | | - call ale#test#SetDirectory('/testplugin/test/fixers') |
| 2 | + call ale#assert#SetUpFixerTest('ruby', 'rubocop') |
10 | 3 |
|
11 | 4 | After: |
12 | | - Restore |
13 | | - |
14 | | - call ale#test#RestoreDirectory() |
| 5 | + call ale#assert#TearDownFixerTest() |
15 | 6 |
|
16 | 7 | Execute(The rubocop callback should return the correct default values): |
17 | 8 | call ale#test#SetFilename('../test-files/ruby/dummy.rb') |
18 | 9 |
|
19 | | - AssertEqual |
| 10 | + GivenCommandOutput ['1.61.0'] |
| 11 | + |
| 12 | + AssertFixer |
20 | 13 | \ { |
21 | 14 | \ 'process_with': 'ale#fixers#rubocop#PostProcess', |
22 | 15 | \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) |
23 | 16 | \ . ' --auto-correct --editor-mode --force-exclusion --stdin %s', |
24 | | - \ }, |
25 | | - \ ale#fixers#rubocop#Fix(bufnr('')) |
| 17 | + \ } |
26 | 18 |
|
27 | 19 | Execute(The rubocop callback should include custom rubocop options): |
28 | 20 | let g:ale_ruby_rubocop_options = '--except Lint/Debugger' |
29 | 21 | call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') |
30 | 22 |
|
31 | | - AssertEqual |
| 23 | + GivenCommandOutput ['1.61.0'] |
| 24 | + |
| 25 | + AssertFixer |
32 | 26 | \ { |
33 | 27 | \ 'process_with': 'ale#fixers#rubocop#PostProcess', |
34 | 28 | \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) |
35 | 29 | \ . ' --except Lint/Debugger' |
36 | 30 | \ . ' --auto-correct --editor-mode --force-exclusion --stdin %s', |
37 | | - \ }, |
38 | | - \ ale#fixers#rubocop#Fix(bufnr('')) |
| 31 | + \ } |
39 | 32 |
|
40 | 33 | Execute(The rubocop callback should use auto-correct-all option when set): |
41 | 34 | let g:ale_ruby_rubocop_auto_correct_all = 1 |
42 | 35 | call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') |
43 | 36 |
|
44 | | - AssertEqual |
| 37 | + GivenCommandOutput ['1.61.0'] |
| 38 | + |
| 39 | + AssertFixer |
45 | 40 | \ { |
46 | 41 | \ 'process_with': 'ale#fixers#rubocop#PostProcess', |
47 | 42 | \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) |
48 | 43 | \ . ' --auto-correct-all --editor-mode --force-exclusion --stdin %s' |
49 | | - \ }, |
50 | | - \ ale#fixers#rubocop#Fix(bufnr('')) |
| 44 | + \ } |
51 | 45 |
|
52 | 46 | Execute(The rubocop post-processor should remove diagnostics content): |
53 | 47 | AssertEqual |
@@ -88,14 +82,15 @@ Execute(The rubocop post-processor should remove diagnostics content): |
88 | 82 | \ ' ''run'']', |
89 | 83 | \ ]) |
90 | 84 |
|
91 | | -Execute(The rubocop callback should not use editor-mode option when configured not to): |
92 | | - let g:ale_ruby_rubocop_editor_mode = 0 |
| 85 | +Execute(The rubocop callback should not use editor-mode option with older versions): |
93 | 86 | call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') |
94 | 87 |
|
95 | | - AssertEqual |
| 88 | + GivenCommandOutput ['1.59.0'] |
| 89 | + |
| 90 | + AssertFixer |
96 | 91 | \ { |
97 | 92 | \ 'process_with': 'ale#fixers#rubocop#PostProcess', |
98 | 93 | \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) |
99 | | - \ . ' --auto-correct-all --force-exclusion --stdin %s' |
100 | | - \ }, |
101 | | - \ ale#fixers#rubocop#Fix(bufnr('')) |
| 94 | + \ . ' --auto-correct --force-exclusion --stdin %s' |
| 95 | + \ } |
| 96 | + |
0 commit comments