Skip to content

Commit

Permalink
Ignore Ruby 2.7 multiline warnings from gems
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed May 2, 2020
1 parent da36620 commit 461e39a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rspec/support/spec/stderr_splitter.rb
Expand Up @@ -6,6 +6,7 @@ class StdErrSplitter
def initialize(original)
@orig_stderr = original
@output_tracker = ::StringIO.new
@last_line = nil
end

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

# Ruby 2.7.0 warnings from keyword argments span multiple lines, extend check above
# to look for the next line.
return if @last_line =~ %r{^\S+/gems/\S+:\d+: warning:} &&
line =~ %r{warning: The called method .* is defined here}

# Ruby 2.7.0 complains about hashes used in place of keyword arguments
# Aruba 0.14.2 uses this internally triggering that here
return if line =~ %r{lib/ruby/2\.7\.0/fileutils\.rb:622: warning:}

@orig_stderr.write(line)
@output_tracker.write(line)
ensure
@last_line = line
end

def has_output?
Expand Down

0 comments on commit 461e39a

Please sign in to comment.