Skip to content

Commit

Permalink
Handle jruby stackoverflow for looped exception test
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Sep 3, 2020
1 parent 468c989 commit 3276f34
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/rspec/core/formatters/exception_presenter_spec.rb
Expand Up @@ -268,6 +268,12 @@ def to_s
end
end

if RSpec::Support::Ruby.jruby?
expected_error = Java::JavaLang::StackOverflowError
else
expected_error = StandardError
end

incorrect_message_exception = FakeException.new(raising_to_s_klass.new, [])

the_presenter = Formatters::ExceptionPresenter.new(incorrect_message_exception, example)
Expand All @@ -276,7 +282,7 @@ def to_s
|
| 1) Example
| Failure/Error: Unable to find matching line from backtrace
| A #{FakeException} for which `exception.message.to_s` raises StandardError.
| A #{FakeException} for which `exception.message.to_s` raises #{expected_error}.
EOS
end

Expand Down

0 comments on commit 3276f34

Please sign in to comment.