From 6af1164039fa43530bb6d22cda2195409a727cc5 Mon Sep 17 00:00:00 2001 From: Derek Kniffin Date: Sun, 14 Aug 2016 22:41:32 -0400 Subject: [PATCH 1/3] Change default exit code behavior to match norm fixes #244 --- lib/thor/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/thor/base.rb b/lib/thor/base.rb index 8cd418637..73198a5b6 100644 --- a/lib/thor/base.rb +++ b/lib/thor/base.rb @@ -621,7 +621,7 @@ def from_superclass(method, default = nil) # A flag that makes the process exit with status 1 if any error happens. def exit_on_failure? - false + true end # From 0bb59b1126cafb5018a8012242fa95ab26b3bbfa Mon Sep 17 00:00:00 2001 From: Derek Kniffin Date: Sun, 14 Aug 2016 22:58:06 -0400 Subject: [PATCH 2/3] Disable exit_on_failure? for tests --- spec/helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/helper.rb b/spec/helper.rb index 7363d5e34..f67ac7ec1 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -44,6 +44,10 @@ ARGV.replace [] end + config.before(:each) do + allow(Thor).to receive(:exit_on_failure?).and_return(false) + end + config.expect_with :rspec do |c| c.syntax = :expect end From 6fd3c1d5d33e8b19e6ba0c1b99c5ab7a126ac240 Mon Sep 17 00:00:00 2001 From: Derek Kniffin Date: Thu, 25 Jan 2018 21:34:38 -0500 Subject: [PATCH 3/3] Update spec stub --- spec/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helper.rb b/spec/helper.rb index 9a55cae8f..96005a3c1 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -45,7 +45,7 @@ end config.before(:each) do - allow(Thor).to receive(:exit_on_failure?).and_return(false) + allow_any_instance_of(Thor::Base::ClassMethods).to receive(:exit_on_failure?).and_return(false) end config.expect_with :rspec do |c|