Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include backtrace in errors reported by raise_error matcher. #177

Merged
merged 1 commit into from
Oct 9, 2012

Conversation

myronmarston
Copy link
Member

It's hard to troubleshoot unexpected errors when the backtrace is silenced,
as it was previously.

Closes #59.

@myronmarston
Copy link
Member Author

Note this depends on rspec/rspec-core#701.

@alindeman / @dchelimsky -- can you review?

attr_writer :backtrace_formatter
def backtrace_formatter
@backtrace_formatter ||= if defined?(::RSpec::Core::Formatters::Helpers)
::RSpec::Core::Formatters::Helpers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather expose this more explicitly in RSpec::Core - something like RSpec::Core::BacktraceFormatters. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@myronmarston
Copy link
Member Author

One other thing to be fixed here:

expect {
  blah
}.to raise_error { |e|
  expect(e.some_attribute).to eq(some_value)
}

In a case like this, if the expectation in the error-matching block fails, the backtrace is not being included in the failure. It'd be cool to find a solution for this (thought it might be complex, in which case I might skip it).

It's hard to troubleshoot unexpected errors when the backtrace is silenced,
as it was previously.

Closes #59.
myronmarston added a commit that referenced this pull request Oct 9, 2012
Include backtrace in errors reported by `raise_error` matcher.
@myronmarston myronmarston merged commit 16a133f into master Oct 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

should_not raise_error annoyingly swallows original exception backtrace
3 participants