Module: RSpec::Core::Example::DebugAtStop

Included in:
RSpec::Core::Example
Defined in:
lib/rspec/debug.rb

Instance Method Summary collapse

Instance Method Details

#initialize(example_group_class, description, user_metadata, example_block = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rspec/debug.rb', line 13

def initialize example_group_class, description, , example_block=nil
  orig_example_block = example_block

  if example_block
    example_block = Proc.new do
      e = DEBUGGER__::SESSION.capture_exception_frames /(exe|bin|lib)\/rspec/ do
        self.instance_exec(&orig_example_block)
      end

      if e
        STDERR.puts <<~MSG
        Failure:
        #{e.message}
        MSG
        DEBUGGER__::SESSION.enter_postmortem_session e
        raise e
      end
    end # Proc.new
  end

  super
end