Skip to content

Commit dcf9e2f

Browse files
committed
indent all extra failure lines correctly in system tests
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.
1 parent b540020 commit dcf9e2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rspec/rails/example/system_example_group.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def driven_by(driver, **driver_options, &blk)
114114
original_after_teardown.bind(self).call
115115
ensure
116116
myio = $stdout
117-
RSpec.current_example.metadata[:extra_failure_lines] = myio.string
117+
myio.rewind
118+
RSpec.current_example.metadata[:extra_failure_lines] = myio.readlines
118119
$stdout = orig_stdout
119120
end
120121
end

0 commit comments

Comments
 (0)