summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-12 22:41:06 +0100
committerw0rp <devw0rp@gmail.com>2017-07-12 22:41:06 +0100
commit588595419739e3fec9cad921824e0e07aadb440d (patch)
treee1fdfc0f9045f49b472d16b20b3f2c18c6742041 /test/handler
parentbc32e24203159945dcf3906a5e08261ccb06e065 (diff)
downloadale-588595419739e3fec9cad921824e0e07aadb440d.zip
Fix #760 - Report problems with configuration files for rubocop
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_rubocop_handler.vader25
1 files changed, 22 insertions, 3 deletions
diff --git a/test/handler/test_rubocop_handler.vader b/test/handler/test_rubocop_handler.vader
index 396ca0ed..3b447394 100644
--- a/test/handler/test_rubocop_handler.vader
+++ b/test/handler/test_rubocop_handler.vader
@@ -1,6 +1,11 @@
-Execute(The rubocop handler should parse lines correctly):
+Before:
runtime ale_linters/ruby/rubocop.vim
+After:
+ unlet! g:lines
+ call ale#linter#Reset()
+
+Execute(The rubocop handler should parse lines correctly):
AssertEqual
\ [
\ {
@@ -36,5 +41,19 @@ Execute(The rubocop handler should parse lines correctly):
\ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[{"severity":"convention","message":"Prefer single-quoted strings...","cop_name":"Style/SomeCop","corrected":false,"location":{"line":83,"column":29,"length":7}},{"severity":"fatal","message":"Some error","cop_name":"Style/SomeOtherCop","corrected":false,"location":{"line":12,"column":2,"length":1}},{"severity":"warning","message":"Regular warning","cop_name":"Style/WarningCop","corrected":false,"location":{"line":10,"column":5,"length":8}},{"severity":"error","message":"Another error","cop_name":"Style/SpaceBeforeBlockBraces","corrected":false,"location":{"line":11,"column":1,"length":1}}]}],"summary":{"offense_count":4,"target_file_count":1,"inspected_file_count":1}}'
\ ])
-After:
- call ale#linter#Reset()
+Execute(Parse errors should be handled for rubocop):
+ let g:lines = [
+ \ '/my/project/.rubocop.yml: Layout/MultilineOperationIndentation has the wrong namespace - should be Style',
+ \ '/my/project/.rubocop.yml: Layout/AlignHash has the wrong namespace - should be Style',
+ \ '{"metadata":{"rubocop_version":"0.48.1","ruby_engine":"ruby","ruby_version":"2.4.1","ruby_patchlevel":"111","ruby_platform":"x86_64-darwin16"},"files":[]}',
+ \]
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'text': 'rubocop configuration error (type :ALEDetail for more information)',
+ \ 'detail': join(g:lines, "\n"),
+ \ },
+ \ ],
+ \ ale_linters#ruby#rubocop#Handle(347, g:lines)