Skip to content

Add a helpful message when an error class passed to `and_raise` requires 1 or more initialization arguments #99

Closed
dchelimsky opened this Issue Jan 29, 2012 · 2 comments

2 participants

@dchelimsky
RSpec member

The and_raise method accepts either a class or an instance, but it only works with a class if the class has a zero-arg initializer.. Right now, when it receives a class with a non-zero-arg initializer the ArgumentError bubbles up, and is confusing for the end user.

and_raise should capture an ArgumentError and raise its own ArgumentError with helpful information as to how to fix the problem.

@coreyhaines

Hey, look, I'm pull request number 100!
#100

Always one to grab the spotlight!

@coreyhaines

Since my error message writing skills aren't always the best, I'm sure you'll want to adjust it to make it include more "helpful information as to how to fix the problem."

@dchelimsky dchelimsky added a commit that referenced this issue Jan 30, 2012
@dchelimsky dchelimsky More detailed error message when and_raise gets a class whose constru…
…ctor requires 1 or more args.

- #99, #100.
1f28dcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.