Programatically set breakpoint for ruby-debug-ide (RubyMine)

278 views Asked by At

Is it possible to programatically set a breakpoint... that is... start the debugger, that RubyMine uses, ruby-debug-ide?

My goal is to somehow start it automatically when a test fails.

1

There are 1 answers

0
Roope Hakulinen On

I was looking for something related this when your question popped out. So what you want to do is to break when certain (or any) test fails? For this purpose you can use the debugger command.

Just add begin...rescue block to your test as follows

begin
  test 'todo' do
    result = todo
    assert_equal 25, result
  end
rescue Minitest::Assertion => e
  debugger

If you aren't using the Minitest, replace the Minitest::Assertion with the appropriate one such as Test::Unit::AssertionFailedError for Test::Unit.