From 47363ad14b4638b51026e0ea1f56d469e15cf5c9 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Mon, 6 Jun 2022 10:58:40 +0200 Subject: [PATCH] Fail if test_hook cannot be run --- spec/test_hook_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/test_hook_spec.rb b/spec/test_hook_spec.rb index 167de49..a17c07b 100644 --- a/spec/test_hook_spec.rb +++ b/spec/test_hook_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'English' + describe 'Test Hook' do it 'adds spaces around =' do out = run 'a=b' @@ -13,10 +15,14 @@ describe 'Test Hook' do end def run(input) - IO.popen ['ruby', "#{__dir__}/test_hook.rb"], mode: File::RDWR do |io| + result = IO.popen ['ruby', "#{__dir__}/test_hook.rb"], mode: File::RDWR do |io| io.write input io.close_write io.read.chomp end + + raise 'Cannot run test_hook.rb' unless $CHILD_STATUS.success? + + result end end