From c58d4cc65a7c78e3ce872de2109a47e1d70df38f Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 4 Apr 2022 21:10:27 +0200 Subject: [PATCH] Use issue expectation helpers in `Lint::Syntax` rule spec --- spec/ameba/rule/lint/syntax_spec.cr | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/ameba/rule/lint/syntax_spec.cr b/spec/ameba/rule/lint/syntax_spec.cr index c46e52f3..2412b0b2 100644 --- a/spec/ameba/rule/lint/syntax_spec.cr +++ b/spec/ameba/rule/lint/syntax_spec.cr @@ -5,23 +5,22 @@ module Ameba::Rule::Lint subject = Syntax.new it "passes if there is no invalid syntax" do - s = Source.new %( + expect_no_issues subject, <<-CRYSTAL def hello puts "totally valid" rescue e: Exception end - ) - subject.catch(s).should be_valid + CRYSTAL end it "fails if there is an invalid syntax" do - s = Source.new %( + expect_issue subject, <<-CRYSTAL def hello puts "invalid" rescue Exception => e + # ^ error: expecting any of these tokens: ;, NEWLINE (not '=>') end - ) - subject.catch(s).should_not be_valid + CRYSTAL end it "reports rule, location and message" do