Created
November 25, 2008 17:40
-
-
Save jamesmacaulay/28993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# debug_in | |
# call debugger only when the stack trace includes a certain file and/or method | |
# | |
# use like: | |
# debug_in(:file => 'order_test', :method => 'test_taxes_included') | |
# debug_in(:r => /taxes.*included/) | |
# | |
# put in test_helper.rb | |
def debug_in(options = {}) | |
debugger if caller.detect {|c| c =~ /#{(options[:file].to_s + ".rb") if options[:file]}.*#{("`" + options[:method].to_s + "'$") if options[:method]}/ && c =~ (options[:r] || //)} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment