Skip to content

Commit

Permalink
Merge pull request #1414 from nobu/verbose-nil
Browse files Browse the repository at this point in the history
Suppress a warning by setting `$VERBOSE` to `nil`
  • Loading branch information
JonRowe authored Feb 19, 2021
2 parents 476b6e9 + 54b9d35 commit 97c972b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/rspec/mocks/verifying_double.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,15 @@ def method_missing(message, *args, &block)
super
end

# @private
module SilentIO
def self.method_missing(*); end
def self.respond_to?(*)
true
end
end

# Redefining `__send__` causes ruby to issue a warning.
old, $stderr = $stderr, SilentIO
old, $VERBOSE = $VERBOSE, nil
def __send__(name, *args, &block)
@__sending_message = name
super
ensure
@__sending_message = nil
end
$stderr = old
$VERBOSE = old

def send(name, *args, &block)
__send__(name, *args, &block)
Expand Down

0 comments on commit 97c972b

Please sign in to comment.