Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix `nil` exception when reporting rspec failures (#25011)

Alan Guo Xiang Tan9d658591d671
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index ba3b9c69ca0..5595e3cbdb9 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -582,7 +582,7 @@ RSpec.configure do |config|
config.after :each do |example|
if example.exception && RspecErrorTracker.exceptions.present?
- lines = RSpec.current_example.metadata[:extra_failure_lines]
+ lines = (RSpec.current_example.metadata[:extra_failure_lines] ||= "")
lines << "~~~~~~~ SERVER EXCEPTIONS ~~~~~~~"