Skip to content

Commit

Permalink
indent all extra failure lines correctly in system tests
Browse files Browse the repository at this point in the history
If the output from Rails' system test teardown is multiple lines, we should try and render all of the lines with proper indentation.

This can happen on `rails/rails@master` now that failure screenshots can include the page HTML (rails/rails@36545), and can actually happen with v6.0.2.2 if the `method_name` ends up being a little too long.
  • Loading branch information
agrobbin committed Apr 20, 2020
1 parent b540020 commit dcf9e2f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rspec/rails/example/system_example_group.rb
Expand Up @@ -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
Expand Down

0 comments on commit dcf9e2f

Please sign in to comment.