Today I Learned

hashrocket A Hashrocket project

Full Backtrace in RSpec

Sometimes an RSpec error message can seem overwhelmingly verbose, other times frustratingly terse. Today I learned that this can be customized in Rails, with the following configuration:

# spec/spec_helper.rb
config.full_backtrace = false # or true?

Turn this on, and every failure will include a stack trace. Turn it off, and it won’t. You can override a false setting at the command line, like so:

$ rspec spec/some/thing_spec.rb --backtrace 

Great for fast debugging.

See rspec --help for more information.

See More #testing TILs