2018-06-16 11:50:59 +00:00
|
|
|
require "../../../spec_helper"
|
2017-10-30 20:35:11 +00:00
|
|
|
|
2018-06-16 11:50:59 +00:00
|
|
|
module Ameba::Rule::Layout
|
2017-10-30 20:35:11 +00:00
|
|
|
subject = TrailingWhitespace.new
|
|
|
|
|
|
|
|
describe TrailingWhitespace do
|
|
|
|
it "passes if all lines do not have trailing whitespace" do
|
2022-12-21 20:14:29 +00:00
|
|
|
expect_no_issues subject, "no-whitespace"
|
2017-10-30 20:35:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "fails if there is a line with trailing whitespace" do
|
2021-11-16 21:30:33 +00:00
|
|
|
source = expect_issue subject,
|
|
|
|
"whitespace at the end \n" \
|
|
|
|
" # ^^ error: Trailing whitespace detected"
|
|
|
|
|
|
|
|
expect_correction source, "whitespace at the end"
|
2017-10-30 20:35:11 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|