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

Follow-up to f5ca96528ddc6cc14e5c86cf2172418ab863e845

Why this change?

`RSpec.current_example.metadata[:extra_failure_lines]` can be `nil` and
calling `<<` on `nil` is not a good idea.

What does this change do?

Set `RSpec.current_example.metadata[:extra_failure_lines]` to `""` as
long as there are exceptions.
This commit is contained in:
Alan Guo Xiang Tan 2023-12-22 13:41:45 +08:00 committed by GitHub
parent d3625f2288
commit 9d658591d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ~~~~~~~"