diff --git a/Gemfile b/Gemfile index f1bf6b395..a605ac476 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ gemspec # Development dependencies gem "rake" gem "test-unit" -gem "test-unit-rr" gem "rspec" gem "racc" gem "rubocop" diff --git a/test/test_helper.rb b/test/test_helper.rb index 55bc999fe..bfbc15905 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,7 +4,6 @@ require "stringio" require "open3" require "test/unit" -require "test/unit/rr" begin require "amber" @@ -41,16 +40,19 @@ def type_name(string) end end - def silence_errors - stub(RBS.logger).error do - yield - end - end - def silence_warnings - stub(RBS.logger).warn do - yield + klass = RBS.logger.class + original_method = klass.instance_method(:warn) + + klass.remove_method(:warn) + klass.define_method(:warn) do |*args, &block| + block&.call() end + + yield + ensure + klass.remove_method(:warn) + klass.define_method(:warn, original_method) end class SignatureManager