Fix rest of the specs

This commit is contained in:
Vitalii Elenhaupt 2022-03-11 18:00:25 +02:00
parent 1cfc926a28
commit 7192b64df0
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0
5 changed files with 4 additions and 4 deletions

View file

@ -61,7 +61,7 @@ module Ameba::Rule::Lint
issue = s.issues.first issue = s.issues.first
issue.rule.should_not be_nil issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:3" issue.location.to_s.should eq "source.cr:1:1"
issue.end_location.to_s.should eq "source.cr:6:3" issue.end_location.to_s.should eq "source.cr:6:3"
issue.message.should eq "Empty `ensure` block detected" issue.message.should eq "Empty `ensure` block detected"
end end

View file

@ -166,7 +166,7 @@ module Ameba::Rule::Lint
issue = s.issues.first issue = s.issues.first
issue.rule.should_not be_nil issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:3" issue.location.to_s.should eq "source.cr:1:1"
issue.end_location.to_s.should eq "source.cr:4:3" issue.end_location.to_s.should eq "source.cr:4:3"
issue.message.should eq( issue.message.should eq(
"Exception handler has shadowed exceptions: IndexError" "Exception handler has shadowed exceptions: IndexError"

View file

@ -95,7 +95,7 @@ module Ameba
commented = false commented = false
lexer = Crystal::Lexer.new(line).tap(&.comments_enabled = true) lexer = Crystal::Lexer.new(line).tap(&.comments_enabled = true)
Tokenizer.new(lexer).run { |t| commented = true if t.type == :COMMENT } Tokenizer.new(lexer).run { |t| commented = true if t.type.comment? }
commented commented
end end
end end

View file

@ -90,7 +90,7 @@ module Ameba::Rule::Style
end end
private def redundant_begin_in_expressions?(node) private def redundant_begin_in_expressions?(node)
node.keyword == :begin node.keyword == Crystal::Expressions::Keyword::Begin
end end
private def inner_handler?(handler) private def inner_handler?(handler)