summaryrefslogtreecommitdiff
path: root/test/command_callback/test_foodcritic_command_callback.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-21 13:38:27 +0000
committerw0rp <devw0rp@gmail.com>2017-11-21 13:38:33 +0000
commitac7f69063db30edfad14fac19b9d06be487885b1 (patch)
treea54c60e3c5bd05d10883d0e9a117e36a9f81801e /test/command_callback/test_foodcritic_command_callback.vader
parentce2986cfa502849e552b126e9df9d090275f98e2 (diff)
downloadale-ac7f69063db30edfad14fac19b9d06be487885b1.zip
#1151 - Overhaul the foodcritic linter for checking files on disk
Diffstat (limited to 'test/command_callback/test_foodcritic_command_callback.vader')
-rw-r--r--test/command_callback/test_foodcritic_command_callback.vader44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/command_callback/test_foodcritic_command_callback.vader b/test/command_callback/test_foodcritic_command_callback.vader
new file mode 100644
index 00000000..e3ad8a70
--- /dev/null
+++ b/test/command_callback/test_foodcritic_command_callback.vader
@@ -0,0 +1,44 @@
+Before:
+ Save g:ale_chef_foodcritic_executable
+ Save g:ale_chef_foodcritic_options
+
+ unlet! g:ale_chef_foodcritic_executable
+ unlet! g:ale_chef_foodcritic_options
+
+ call ale#test#SetDirectory('/testplugin/test')
+
+ runtime ale_linters/chef/foodcritic.vim
+
+After:
+ Restore
+
+ unlet! b:ale_chef_foodcritic_executable
+ unlet! b:ale_chef_foodcritic_options
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(The default command should be correct):
+ AssertEqual
+ \ 'foodcritic',
+ \ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('foodcritic') . ' %s',
+ \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))
+
+Execute(Extra options should be included with escapeed tildes (~)):
+ let b:ale_chef_foodcritic_options = '-t ~F011'
+
+ AssertEqual
+ \ ale#Escape('foodcritic') . ' -t \~F011 %s',
+ \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))
+
+Execute(The executable should be configurable):
+ let b:ale_chef_foodcritic_executable = 'foobar'
+
+ AssertEqual
+ \ 'foobar',
+ \ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('foobar') . ' %s',
+ \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))