From 9e09b7ca3559e2c14ed2401bb666b441b22dafff Mon Sep 17 00:00:00 2001 From: Ryan Rosenblum Date: Fri, 24 Aug 2018 11:33:59 -0400 Subject: Update all Ruby linters to work consistently with bundler --- .../test_brakeman_command_callback.vader | 17 ++++++++++-- ...est_rails_best_practices_command_callback.vader | 4 +-- .../test_reek_command_callback.vader | 30 +++++++++++++++++----- .../test_rubocop_command_callback.vader | 4 +-- 4 files changed, 42 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/command_callback/test_brakeman_command_callback.vader b/test/command_callback/test_brakeman_command_callback.vader index 61be4caf..15dbbe1c 100644 --- a/test/command_callback/test_brakeman_command_callback.vader +++ b/test/command_callback/test_brakeman_command_callback.vader @@ -12,7 +12,8 @@ Execute(The brakeman command callback should detect absence of a valid Rails app Execute(The brakeman command callback should find a valid Rails app root): call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb') - AssertLinter 'brakeman', 'brakeman -f json -q -p ' + AssertLinter 'brakeman', ale#Escape('brakeman') + \ . ' -f json -q -p ' \ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app')) Execute(The brakeman command callback should include configured options): @@ -20,5 +21,17 @@ Execute(The brakeman command callback should include configured options): let g:ale_ruby_brakeman_options = '--combobulate' - AssertLinter 'brakeman', 'brakeman -f json -q --combobulate -p ' + AssertLinter 'brakeman', ale#Escape('brakeman') + \ . ' -f json -q --combobulate -p ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app')) + +Execute(Setting bundle appends 'exec brakeman'): + call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb') + + let g:ale_ruby_brakeman_executable = 'bundle' + let g:ale_ruby_brakeman_options = '--combobulate' + + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec brakeman' + \ . ' -f json -q --combobulate -p ' \ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app')) diff --git a/test/command_callback/test_rails_best_practices_command_callback.vader b/test/command_callback/test_rails_best_practices_command_callback.vader index bc7c8e85..ce6bdfb4 100644 --- a/test/command_callback/test_rails_best_practices_command_callback.vader +++ b/test/command_callback/test_rails_best_practices_command_callback.vader @@ -28,9 +28,9 @@ Execute(Should be able to set a custom executable): \ . b:suffix Execute(Setting bundle appends 'exec rails_best_practices'): - let g:ale_ruby_rails_best_practices_executable = 'path to/bundle' + let g:ale_ruby_rails_best_practices_executable = 'bundle' - AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + AssertLinter 'bundle', ale#Escape('bundle') \ . ' exec rails_best_practices' \ . ' ' . b:args \ . ' ' . ale#Escape(b:app_path) diff --git a/test/command_callback/test_reek_command_callback.vader b/test/command_callback/test_reek_command_callback.vader index 059e5e36..963247aa 100644 --- a/test/command_callback/test_reek_command_callback.vader +++ b/test/command_callback/test_reek_command_callback.vader @@ -7,8 +7,8 @@ After: Execute(The reek callbacks should return the correct default values): WithChainResults ['reek 5.0.0'] AssertLinter 'reek', [ - \ 'reek --version', - \ 'reek -f json --no-progress --no-color --stdin-filename %s', + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s', \] " Try with older versions. @@ -16,19 +16,35 @@ Execute(The reek callbacks should return the correct default values): WithChainResults ['reek 4.8.2'] AssertLinter 'reek', [ - \ 'reek --version', - \ 'reek -f json --no-progress --no-color', + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color', \] +Execute(Setting bundle appends 'exec reek'): + let g:ale_ruby_reek_executable = 'bundle' + + WithChainResults ['reek 5.0.0'] + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec reek' + \ . ' -f json --no-progress --no-color --stdin-filename %s', + + " Try with older versions. + call ale#semver#ResetVersionCache() + + WithChainResults ['reek 4.8.2'] + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec reek' + \ . ' -f json --no-progress --no-color' + Execute(The reek version check should be cached): WithChainResults ['reek 5.0.0'] AssertLinter 'reek', [ - \ 'reek --version', - \ 'reek -f json --no-progress --no-color --stdin-filename %s', + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s', \] WithChainResults [] AssertLinter 'reek', [ \ '', - \ 'reek -f json --no-progress --no-color --stdin-filename %s', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s', \] diff --git a/test/command_callback/test_rubocop_command_callback.vader b/test/command_callback/test_rubocop_command_callback.vader index 7f42a8c0..b6f4590e 100644 --- a/test/command_callback/test_rubocop_command_callback.vader +++ b/test/command_callback/test_rubocop_command_callback.vader @@ -21,9 +21,9 @@ Execute(Should be able to set a custom executable): \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) Execute(Setting bundle appends 'exec rubocop'): - let g:ale_ruby_rubocop_executable = 'path to/bundle' + let g:ale_ruby_rubocop_executable = 'bundle' - AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + AssertLinter 'bundle', ale#Escape('bundle') \ . ' exec rubocop' \ . ' --format json --force-exclusion --stdin ' \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) -- cgit v1.2.3