summaryrefslogtreecommitdiff
path: root/test/command_callback/test_slimlint_command_callback.vader
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@stellenticket.de>2017-09-02 16:48:00 +0200
committerMarkus Doits <markus.doits@stellenticket.de>2017-09-15 18:56:59 +0200
commit6ebd8f355c974cb6b7c5d5aff20603c8c4b38feb (patch)
tree2bee605e0ef8e9d856b004acb8b6a7472d706d0d /test/command_callback/test_slimlint_command_callback.vader
parenta59d1ddbf39fac6463c3b8748faf2651c9f9130d (diff)
downloadale-6ebd8f355c974cb6b7c5d5aff20603c8c4b38feb.zip
slimlint: Search for .rubocop.yml and use it
This fixes slim-lint not honoring a `.rubocop.yml` in the file's or parent directory. Due to the way slim-lint calls rubocop, it requires the special `SLIM_LINT_RUBUCOP_CONF` env var to pick up the `.rubocop.yml` if it is not run on the real file (which is the case here). See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop
Diffstat (limited to 'test/command_callback/test_slimlint_command_callback.vader')
-rw-r--r--test/command_callback/test_slimlint_command_callback.vader35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/command_callback/test_slimlint_command_callback.vader b/test/command_callback/test_slimlint_command_callback.vader
new file mode 100644
index 00000000..1bff4288
--- /dev/null
+++ b/test/command_callback/test_slimlint_command_callback.vader
@@ -0,0 +1,35 @@
+Before:
+ runtime ale_linters/slim/slimlint.vim
+
+ let g:default_command = 'slim-lint %t'
+
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+After:
+ Restore
+
+ unlet! g:default_command
+
+ let g:ale_has_override = {}
+
+ call ale#linter#Reset()
+ call ale#test#RestoreDirectory()
+
+Execute(The default command should be correct):
+ AssertEqual g:default_command, ale_linters#slim#slimlint#GetCommand(bufnr(''))
+
+Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
+ call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')
+
+ AssertEqual
+ \ 'SLIM_LINT_RUBUCOP_CONF=''/testplugin/test/slimlint-test-files/.rubocop.yml'' ' . g:default_command,
+ \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
+
+Execute(The command should have the .rubocop.yml prepended as an env var if one exists on win32):
+ call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')
+
+ let g:ale_has_override['win32'] = 1
+
+ AssertEqual
+ \ 'set SLIM_LINT_RUBUCOP_CONF=''/testplugin/test/slimlint-test-files/.rubocop.yml'' && ' . g:default_command,
+ \ ale_linters#slim#slimlint#GetCommand(bufnr(''))