diff --git a/lib/rspec/rails/example/system_example_group.rb b/lib/rspec/rails/example/system_example_group.rb index 57266d0a27..59c5606cca 100644 --- a/lib/rspec/rails/example/system_example_group.rb +++ b/lib/rspec/rails/example/system_example_group.rb @@ -114,7 +114,8 @@ def driven_by(driver, **driver_options, &blk) original_after_teardown.bind(self).call ensure myio = $stdout - RSpec.current_example.metadata[:extra_failure_lines] = myio.string + myio.rewind + RSpec.current_example.metadata[:extra_failure_lines] = myio.readlines $stdout = orig_stdout end end