From 54b9d3509baeb3797afc1de99420d90e8106264c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 19 Feb 2021 15:18:02 +0900 Subject: [PATCH] Suppress a warning by setting `$VERBOSE` to `nil` --- lib/rspec/mocks/verifying_double.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/rspec/mocks/verifying_double.rb b/lib/rspec/mocks/verifying_double.rb index 39723b9fc..e75478f9f 100644 --- a/lib/rspec/mocks/verifying_double.rb +++ b/lib/rspec/mocks/verifying_double.rb @@ -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)