From 67ad756c51ed144d615e8d023225472fcc741610 Mon Sep 17 00:00:00 2001
From: Masataka Kuwabara
Date: Sat, 23 Jul 2016 23:42:11 +0900
Subject: [PATCH] Fix when RSpec exits by segmentation fault.
---
lib/guard/rspec/rspec_process.rb | 4 ++--
spec/lib/guard/rspec/rspec_process_spec.rb | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/guard/rspec/rspec_process.rb b/lib/guard/rspec/rspec_process.rb
index 27f7c98c..d6772c45 100644
--- a/lib/guard/rspec/rspec_process.rb
+++ b/lib/guard/rspec/rspec_process.rb
@@ -32,8 +32,8 @@ def _run
Compat::UI.debug(format(msg, command, exit_code.inspect))
unless [0, Command::FAILURE_EXIT_CODE].include?(exit_code)
- msg = "Failed: %s (exit code: %d)"
- raise Failure, format(msg, command.inspect, exit_code)
+ msg = "Failed: %s (exit code: %s)"
+ raise Failure, format(msg, command.inspect, exit_code.inspect)
end
exit_code
end
diff --git a/spec/lib/guard/rspec/rspec_process_spec.rb b/spec/lib/guard/rspec/rspec_process_spec.rb
index 648cd64e..69456f56 100644
--- a/spec/lib/guard/rspec/rspec_process_spec.rb
+++ b/spec/lib/guard/rspec/rspec_process_spec.rb
@@ -52,6 +52,15 @@
end
end
+ context "without any exit code" do
+ let(:exit_code) { nil }
+
+ it "fails" do
+ expect { subject }.
+ to raise_error(Guard::RSpec::RSpecProcess::Failure, /Failed: /)
+ end
+ end
+
context "with the failure code for normal test failures" do
let(:exit_code) { Guard::RSpec::Command::FAILURE_EXIT_CODE }