]> git.madduck.net Git - etc/vim.git/blob - test/handler/test_rails_best_practices_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / handler / test_rails_best_practices_handler.vader
1 Before:
2   call ale#test#SetDirectory('/testplugin/test/handler')
3   cd ..
4
5   runtime ale_linters/ruby/rails_best_practices.vim
6
7 After:
8   call ale#test#RestoreDirectory()
9   call ale#linter#Reset()
10
11 Execute(The rails_best_practices handler should parse JSON correctly):
12   call ale#test#SetFilename('test-files/ruby/valid_rails_app/app/models/thing.rb')
13
14   AssertEqual
15   \  [
16   \      {
17   \          'lnum': 5,
18   \          'text': 'use local variable',
19   \          'type': 'W',
20   \      },
21   \      {
22   \          'lnum': 10,
23   \          'text': 'other advice',
24   \          'type': 'W',
25   \      }
26   \  ],
27   \  ale_linters#ruby#rails_best_practices#Handle(bufnr(''), [
28   \  '[',
29   \    '{',
30   \      '"message": "use local variable",',
31   \      '"line_number": "5",',
32   \      printf('"filename": "%s"', substitute(expand('%:p'), '\\', '\\\\', 'g')),
33   \    '},{',
34   \      '"message": "other advice",',
35   \      '"line_number": "10",',
36   \      printf('"filename": "%s"', substitute(expand('%:p'), '\\', '\\\\', 'g')),
37   \    '}',
38   \  ']'
39   \  ])
40
41 Execute(The rails_best_practices handler should parse JSON correctly when there is no output from the tool):
42   AssertEqual
43   \ [],
44   \ ale_linters#ruby#rails_best_practices#Handle(347, [
45   \ ])
46
47 Execute(The rails_best_practices handler should handle garbage output):
48   AssertEqual
49   \ [],
50   \ ale_linters#ruby#rails_best_practices#Handle(347, [
51   \   'No such command in 2.4.1 of ruby',
52   \ ])