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:
parent
e6576546de
commit
90dacb8f25
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue