mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add normalize
parameter to expect_correction
This commit is contained in:
parent
7cb0c15747
commit
4b67e4b900
2 changed files with 4 additions and 3 deletions
|
@ -24,7 +24,7 @@ module Ameba::Rule::Layout
|
|||
|
||||
it "fails if last line is not blank" do
|
||||
source = expect_issue subject, "\n\n\n puts 22 # error: Trailing newline missing", normalize: false
|
||||
expect_correction source, "\n\n\n puts 22\n"
|
||||
expect_correction source, "\n\n\n puts 22\n", normalize: false
|
||||
end
|
||||
|
||||
context "when unnecessary blank line has been detected" do
|
||||
|
|
|
@ -50,8 +50,8 @@ module Ameba::Spec::ExpectIssue
|
|||
def expect_issue(rules : Rule::Base | Enumerable(Rule::Base),
|
||||
annotated_code : String,
|
||||
path = "",
|
||||
normalize = true,
|
||||
*,
|
||||
normalize = true,
|
||||
file = __FILE__,
|
||||
line = __LINE__,
|
||||
**replacements)
|
||||
|
@ -81,7 +81,8 @@ module Ameba::Spec::ExpectIssue
|
|||
source
|
||||
end
|
||||
|
||||
def expect_correction(source, correction, *, file = __FILE__, line = __LINE__)
|
||||
def expect_correction(source, correction, *, normalize = true, file = __FILE__, line = __LINE__)
|
||||
correction = normalize_code(correction) if normalize
|
||||
raise "Use `expect_no_corrections` if the code will not change" unless source.correct
|
||||
return if correction == source.code
|
||||
|
||||
|
|
Loading…
Reference in a new issue