From 3d69cb8aafdbab63e9c7ce7a84922151970ef7a6 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Fri, 29 May 2020 14:41:28 +0100 Subject: [PATCH] Fix bug with bisect and custom error codes --- lib/rspec/core/invocations.rb | 2 +- spec/rspec/core/invocations_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/rspec/core/invocations.rb b/lib/rspec/core/invocations.rb index 24e8234e3d..7e5049f686 100644 --- a/lib/rspec/core/invocations.rb +++ b/lib/rspec/core/invocations.rb @@ -37,7 +37,7 @@ def call(options, err, out) runner, options.args, formatter ) - success ? 0 : 1 + success ? 0 : runner.configuration.failure_exit_code end private diff --git a/spec/rspec/core/invocations_spec.rb b/spec/rspec/core/invocations_spec.rb index 6edbe4a5f7..a925fb0b62 100644 --- a/spec/rspec/core/invocations_spec.rb +++ b/spec/rspec/core/invocations_spec.rb @@ -111,6 +111,16 @@ def run_invocation expect(exit_code).to eq(1) end + + context "with a custom failure code set" do + it "returns the custom failure code" do + in_sub_process do + RSpec.configuration.failure_exit_code = 42 + exit_code = run_invocation + expect(exit_code).to eq(42) + end + end + end end context "and the verbose option is specified" do