Using breakpointer to debug rails tests
I played with breakpointer for a few minutes to check it out when I was first learning Rails, but I've never actually used it for serious debugging. But yesterday I had a unit test that was failing and I could not figure why, so I decided I would try it out. I discovered that breakpointer works really well for debugging tests! I had only used it in the context of debugging actions.
Using the breakpointer is really easy, just insert breakpoint
at any point in your code. When you run your tests, it will open up an irb
session whenever it encounters a breakpoint
in your code.
.....Executing break point at ./test/unit/event_test.rb:36 in `test_duration'
irb(test_duration_with_hash=(EventTest)):001:0>