开发者

Running RSpec in debug mode

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 de开发者_StackOverflow社区bugger line into the code. Any pointers?


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, your code seems to break inside rspec. It'd be nice if we could break at the failing assert line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜