Created
November 2, 2011 16:44
-
-
Save betawaffle/1334162 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
I just stuck that in the spec_helper.rb. |
This file contains hidden or 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
begin | |
require 'pry' | |
rescue LoadError | |
class Object | |
def pry | |
# Do Nothing. | |
end | |
end | |
end | |
# ... | |
if defined? Pry | |
class Binding | |
def fake(file, line) | |
orig = method(:eval) | |
define_singleton_method(:eval) do |s, f = nil, l = nil| | |
orig.call(s, f || file.to_s, l || line.to_i) | |
end | |
self | |
end | |
end | |
class RSpec::Core::Example | |
def set_exception_with_pry(e) | |
set_exception_without_pry(e) | |
file, line, _ = e.backtrace.find { |f| f.match /^#{Rails.root}/ }.split(':', 3) | |
Pry.binding_for(@example_group_instance).fake(file, line).pry | |
end | |
alias_method :set_exception_without_pry, :set_exception | |
alias_method :set_exception, :set_exception_with_pry | |
end | |
end |
I'm not at that stage yet.
Spork complicates this...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any way you can make it a flag? So I could do:
or somesuch?