Skip to content

Instantly share code, notes, and snippets.

@pirj
Last active December 15, 2020 09:21
Show Gist options
  • Save pirj/0604fa90fb6a21849e6d to your computer and use it in GitHub Desktop.
Save pirj/0604fa90fb6a21849e6d to your computer and use it in GitHub Desktop.
Locate those annoying MESSages during tests
# Put this in your test helper
# Use `caller` to locate where in code that BUGGER is
class IO
BUGGER = /annoying/
def print *args
binding.pry if args.any? { |arg| arg =~ BUGGER }
super *args
end
def puts *args
binding.pry if args.any? { |arg| arg =~ BUGGER }
super *args
end
def warn *args
binding.pry if args.any? { |arg| arg =~ BUGGER }
super *args
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment