Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 63c03e5

Browse files
authored
Merge pull request #401 from rspec/fix-warning-detection-for-ruby-27
Ignore Ruby 2.7 multiline warnings from gems
2 parents 9cec8e8 + 49d0595 commit 63c03e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/rspec/support/spec/stderr_splitter.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class StdErrSplitter
66
def initialize(original)
77
@orig_stderr = original
88
@output_tracker = ::StringIO.new
9+
@last_line = nil
910
end
1011

1112
respond_to_name = (::RUBY_VERSION.to_f < 1.9) ? :respond_to? : :respond_to_missing?
@@ -38,12 +39,19 @@ def to_io
3839
def write(line)
3940
return if line =~ %r{^\S+/gems/\S+:\d+: warning:} # http://rubular.com/r/kqeUIZOfPG
4041

42+
# Ruby 2.7.0 warnings from keyword argments span multiple lines, extend check above
43+
# to look for the next line.
44+
return if @last_line =~ %r{^\S+/gems/\S+:\d+: warning:} &&
45+
line =~ %r{warning: The called method .* is defined here}
46+
4147
# Ruby 2.7.0 complains about hashes used in place of keyword arguments
4248
# Aruba 0.14.2 uses this internally triggering that here
4349
return if line =~ %r{lib/ruby/2\.7\.0/fileutils\.rb:622: warning:}
4450

4551
@orig_stderr.write(line)
4652
@output_tracker.write(line)
53+
ensure
54+
@last_line = line
4755
end
4856

4957
def has_output?

0 commit comments

Comments
 (0)