tags:

views:

104

answers:

1

This is a short question: I am looking for a way to run specs in debug mode, with the -u switch, so that RSpec would drop to console whenever it failed, without having to add a debugger line into the code. Any pointers?

+3  A: 

Will answer my own question.

Following this tutorial, I created a custom formatter, as in:

require "spec/runner/formatter/specdoc_formatter"

class DebuggerFormatter < Spec::Runner::Formatter::SpecdocFormatter
  def example_failed(example, counter, failure)
    super
    debugger if Kernel.respond_to?(:debugger)
  end
end
hakanensari