Add MaxLineLength option to Style/VerboseBlock rule

This commit is contained in:
Sijawusz Pur Rahnama 2021-01-30 18:22:10 +01:00
parent a53d44617d
commit 4b7f3ba6ee
2 changed files with 28 additions and 0 deletions

View file

@ -90,6 +90,21 @@ module Ameba::Rule::Style
.catch(source).should_not be_valid
end
it "#max_line_length" do
source = Source.new %(
(1..3).tap &.tap &.tap &.tap &.tap &.tap &.tap do |i|
i.to_s.reverse.strip.blank?
end
)
rule = VerboseBlock.new
rule
.tap(&.max_line_length = 60)
.catch(source).should be_valid
rule
.tap(&.max_line_length = nil)
.catch(source).should_not be_valid
end
it "#max_length" do
source = Source.new %(
(1..3).tap { |i| i.to_s.split.reverse.join.strip.blank? }