redding/assert — pull request #133 by kellyredding (2013-06-03 20:12:52+00:00)
Title: `with_backtrace` context helper method

This method takes a backtrace and block. It then runs the block and
takes any results generated by the block and replaces their backtrace
with the given backtrace.

This allows 3rd-party tools to write their own custom assertions
and have them abstract the 3rd-party backtraces that any results
would have.

An example usage would be:

```ruby
def assert_some_custom_behavior(*args)
with_backtrace(caller) do
# asset some things (generate results)
end
end
```

**Note**: this _does not_ affect error results. These results need
to have "pure" backtraces to assist in debugging (error result
backtraces are never modified in Assert). This _will_, however,
affect skip and halt-on-fail results: `with_backtrace` rescues the
exceptions raised in those scenarios and sets the exception's
backtrace to the given backtrace and then re-raises. This way you
get both the halt behavior of the result and the backtrace abstraction
of `with_exception`.

@jcredding this should help with your MR custom assertions. I'm going to head over there and test this in MR. Ready for review.