开发者

Running RSpec in debug mode

开发者 https://www.devze.com 2022-12-27 08:55 出处:网络
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社

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

精彩评论

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