Skip to content

Commit

Permalink
remove_method
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Jan 30, 2021
1 parent edf23b1 commit 3290258
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ def silence_warnings
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

Expand Down

0 comments on commit 3290258

Please sign in to comment.