summaryrefslogtreecommitdiff
path: root/test/command_callback/test_brakeman_command_callback.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-21 22:33:34 +0100
committerw0rp <devw0rp@gmail.com>2017-06-21 22:33:34 +0100
commitdab6f39eb0b5d0dd77a8dc3fe58d0648d82696f7 (patch)
tree18faefa99cc56fee65db35c007c0e2e267166cc6 /test/command_callback/test_brakeman_command_callback.vader
parentab534c2995dabfb8adcdc62d0ac66ed1b1110f4c (diff)
downloadale-dab6f39eb0b5d0dd77a8dc3fe58d0648d82696f7.zip
Fix some escaping and make some tests set filenames consistently
Diffstat (limited to 'test/command_callback/test_brakeman_command_callback.vader')
-rw-r--r--test/command_callback/test_brakeman_command_callback.vader46
1 files changed, 31 insertions, 15 deletions
diff --git a/test/command_callback/test_brakeman_command_callback.vader b/test/command_callback/test_brakeman_command_callback.vader
index 262f865e..607aec64 100644
--- a/test/command_callback/test_brakeman_command_callback.vader
+++ b/test/command_callback/test_brakeman_command_callback.vader
@@ -1,26 +1,42 @@
Before:
- runtime ale_linters/ruby/brakeman.vim
+ Save g:ale_ruby_brakeman_options
+
+ runtime ale_linters/ruby/brakeman.vim
+
+ let g:ale_ruby_brakeman_options = ''
+
+ silent! cd /testplugin/test/command_callback
+ let g:dir = getcwd()
After:
- call ale#linter#Reset()
+ Restore
+
+ silent execute 'cd ' . fnameescape(g:dir)
+ unlet! g:dir
+
+ call ale#linter#Reset()
Execute(The brakeman command callback should detect absence of a valid Rails app):
- cd /testplugin/test/ruby_fixtures/not_a_rails_app/
- AssertEqual
- \ '',
- \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
+ call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/test.rb')
+
+ AssertEqual
+ \ '',
+ \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
Execute(The brakeman command callback should find a valid Rails app root):
- cd /testplugin/test/ruby_fixtures/valid_rails_app/db/
- AssertEqual
- \ 'brakeman -f json -q -p /testplugin/test/ruby_fixtures/valid_rails_app',
- \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
+ call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
+
+ AssertEqual
+ \ 'brakeman -f json -q -p '
+ \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
Execute(The brakeman command callback should include configured options):
- cd /testplugin/test/ruby_fixtures/valid_rails_app/db/
- let g:ale_ruby_brakeman_options = '--combobulate'
+ call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
+ let g:ale_ruby_brakeman_options = '--combobulate'
- AssertEqual
- \ 'brakeman -f json -q --combobulate -p /testplugin/test/ruby_fixtures/valid_rails_app',
- \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
+ AssertEqual
+ \ 'brakeman -f json -q --combobulate -p '
+ \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ ale_linters#ruby#brakeman#GetCommand(bufnr(''))