We're hiring!

We're actively seeking developers and designers for our Ann Arbor & Detroit locations.

RSpec Backtrace Filtering

Recently I ran into some trouble with the way I was trying to use the Mongoid gem. Some error was happening, but I wasn’t getting good output on the screen. Eventually I realized that RSpec (version 2) was filtering out parts of my backtrace.

Here’s the default configuration for RSpec’s backtrace filtering:

Since this filter configuration is matching lines with the word gem, the Mongoid errors I was hoping to see were getting filtered out. To get around my problem, I temporarily changed the configuration to this:

Not particularily elegant.

Generally speaking I like the backtrace filtering, but sometimes I want to see the whole thing. Is anyone aware of any sweet command line parameters to RSpec or other tricks to make it a little easier to disable the filter sometimes? A formatter maybe? Or should I hack a configuration variable into my runner?

Matt Fletcher (74 Posts)

Matt is a software practitioner with Atomic Object.

This entry was posted in Development Techniques and tagged . Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. Jean-Michel GARNIER
    Posted August 25, 2011 at 1:40 pm

    Thanks, you made my day! I agree with you, there should more doc about this and a more elegant way!

  2. Posted August 13, 2012 at 8:31 pm

    > Generally speaking I like the backtrace filtering, but sometimes I want to see the whole thing. Is anyone aware of any sweet command line parameters to RSpec or other tricks to make it a little easier to disable the filter sometimes?

    There is the -b/–backtrace option, which disables the filter and prints the entire stack trace.