From 80f1817ec850f44a80f7d10fafb79d45c184fab8 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Tue, 30 Jul 2024 18:50:55 -0400 Subject: [PATCH] Add `expect_syntax_error` spec helper --- spec_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec_helper.rb b/spec_helper.rb index af1c38587..34bc068a5 100644 --- a/spec_helper.rb +++ b/spec_helper.rb @@ -36,3 +36,7 @@ def report_on_exception=(value) ARGV.unshift $0 MSpecRun.main end + +def expect_syntax_error(ruby_src) + -> { eval(ruby_src) }.should raise_error(SyntaxError) +end