1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

rewrite mock_backtrace to use define_singleton_method.

This commit is contained in:
Robert Gleeson 2014-03-10 01:22:09 +01:00
parent e6576546de
commit 90dacb8f25

View file

@ -68,11 +68,9 @@ module PryTestHelpers
end
def mock_exception(*mock_backtrace)
e = StandardError.new("mock exception")
(class << e; self; end).class_eval do
define_method(:backtrace) { mock_backtrace }
StandardError.new.tap do |e|
e.define_singleton_method(:backtrace) { mock_backtrace }
end
e
end
end