From c89d32fcf6b3326e36fdaf97011c8814c454c236 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 4 Apr 2022 21:07:53 +0200 Subject: [PATCH] Use issue expectation helpers in `Lint::UselessConditionInWhen` rule spec --- .../ameba/rule/lint/useless_condition_in_when_spec.cr | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/ameba/rule/lint/useless_condition_in_when_spec.cr b/spec/ameba/rule/lint/useless_condition_in_when_spec.cr index 3dadc3bb..9fffc4a9 100644 --- a/spec/ameba/rule/lint/useless_condition_in_when_spec.cr +++ b/spec/ameba/rule/lint/useless_condition_in_when_spec.cr @@ -5,25 +5,24 @@ module Ameba::Rule::Lint describe UselessConditionInWhen do it "passes if there is not useless condition" do - s = Source.new %( + expect_no_issues subject, <<-CRYSTAL case when utc? io << " UTC" when local? Format.new(" %:z").format(self, io) if utc? end - ) - subject.catch(s).should be_valid + CRYSTAL end it "fails if there is useless if condition" do - s = Source.new %( + expect_issue subject, <<-CRYSTAL case when utc? io << " UTC" if utc? + # ^^^^ error: Useless condition in when detected end - ) - subject.catch(s).should_not be_valid + CRYSTAL end it "reports rule, location and message" do