Refactor Style/PredicateName rule

Do not report `has_<name>?` method names
This commit is contained in:
Sijawusz Pur Rahnama 2022-11-13 20:12:23 +01:00
parent 2811352cae
commit 52bf0a5be4
2 changed files with 9 additions and 15 deletions

View file

@ -30,7 +30,7 @@ module Ameba::Rule::Style
it "reports rule, pos and message" do
s = Source.new %q(
class Image
def has_picture?(x)
def is_valid?(x)
true
end
end
@ -42,7 +42,7 @@ module Ameba::Rule::Style
issue.location.to_s.should eq "source.cr:2:3"
issue.end_location.to_s.should eq "source.cr:4:5"
issue.message.should eq(
"Favour method name 'picture?' over 'has_picture?'")
"Favour method name 'valid?' over 'is_valid?'")
end
it "ignores if alternative name isn't valid syntax" do