8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/rspec/debugging/debug_it.rb', line 8
def initialize(example_group_class, description, user_metadata, example_block=nil)
return super unless user_metadata[:debug] || ENABLED
if example_block
orig_example_block = example_block
example_block = Proc.new do
e = DEBUGGER__::SESSION.capture_exception_frames /(exe|bin|lib)\/rspec/ do
instance_exec(&orig_example_block)
end
if e
STDERR.puts <<~MSG
Error:
#{e.message}
MSG
DEBUGGER__::SESSION.enter_postmortem_session e
raise e
end
end elsif user_metadata[:debug] && user_metadata[:skip] == RSpec::Core::Pending::NOT_YET_IMPLEMENTED
user_metadata.delete(:skip)
file, line = caller[2].split(":")
example_block = Proc.new do
STDERR.puts <<~MSG
debugging: #{file}:#{line}
MSG
debugger
end
end
super
end
|