Skip to content

Commit

Permalink
fixup! Only print backtrace if it is present
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Mar 12, 2020
1 parent 0d5fde4 commit acf6bb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/rspec/core/formatters/exception_presenter.rb
Expand Up @@ -55,7 +55,8 @@ def formatted_cause(exception)
cause << " #{line}"
end

cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
backtrace = backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata)
cause << (" #{backtrace.first}") unless backtrace.empty?
end

cause
Expand Down
1 change: 0 additions & 1 deletion spec/rspec/core/formatters/exception_presenter_spec.rb
Expand Up @@ -257,7 +257,6 @@ def initialize(message, backtrace = [], cause = nil)
| # ------------------
| # --- Caused by: ---
| # A badly implemented exception
| #
EOS
end

Expand Down

0 comments on commit acf6bb0

Please sign in to comment.