Skip to content

Commit 80f1817

Browse files
committed
Add expect_syntax_error spec helper
1 parent 1bd7ae7 commit 80f1817

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ def report_on_exception=(value)
3636
ARGV.unshift $0
3737
MSpecRun.main
3838
end
39+
40+
def expect_syntax_error(ruby_src)
41+
-> { eval(ruby_src) }.should raise_error(SyntaxError)
42+
end

0 commit comments

Comments
 (0)