mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Use issue expectation helpers in Layout::LineLength
rule spec
This commit is contained in:
parent
390b26d7f1
commit
8a37d5bbe2
1 changed files with 8 additions and 6 deletions
|
@ -6,13 +6,15 @@ module Ameba::Rule::Layout
|
||||||
|
|
||||||
describe LineLength do
|
describe LineLength do
|
||||||
it "passes if all lines are shorter than MaxLength symbols" do
|
it "passes if all lines are shorter than MaxLength symbols" do
|
||||||
source = Source.new "short line"
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
subject.catch(source).should be_valid
|
short line
|
||||||
|
CRYSTAL
|
||||||
end
|
end
|
||||||
|
|
||||||
it "passes if line consists of MaxLength symbols" do
|
it "passes if line consists of MaxLength symbols" do
|
||||||
source = Source.new "*" * subject.max_length
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
subject.catch(source).should be_valid
|
#{"*" * subject.max_length}
|
||||||
|
CRYSTAL
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fails if there is at least one line longer than MaxLength symbols" do
|
it "fails if there is at least one line longer than MaxLength symbols" do
|
||||||
|
@ -33,10 +35,10 @@ module Ameba::Rule::Layout
|
||||||
|
|
||||||
context "properties" do
|
context "properties" do
|
||||||
it "allows to configure max length of the line" do
|
it "allows to configure max length of the line" do
|
||||||
source = Source.new long_line
|
|
||||||
rule = LineLength.new
|
rule = LineLength.new
|
||||||
rule.max_length = long_line.size
|
rule.max_length = long_line.size
|
||||||
rule.catch(source).should be_valid
|
|
||||||
|
expect_no_issues rule, long_line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue