-
Notifications
You must be signed in to change notification settings - Fork 31
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
parse the last line of the block only on failure???? #21
Comments
OMG this would be amazing. |
This is a really interesting idea, but I do have a couple concerns...
let(:x) { ... }
let(:y) { ... }
let(:z) { ... }
it "makes two assertions"
assert { x == y }
x == z
end ...but this seems weird. The user is essentially nesting an I guess part of the point of this is to strongly encourage "one assertion per example"? My rule of thumb is:
Anyhow...if I used wrong (which I don't, although, I've often thought it looks really cool...but rspec-expectations has always met my needs well), I would not want this behavior for the reasons I've outlined above. That said, maybe my concerns are just a problem for my style of specs, and may not be an issue for most of other people. I don't know. |
I do think it's interesting! It turns out that it is only looking at the last statement, but the It's probably a bit more complicated than that -- and I have no idea On Mon, Jun 18, 2012 at 6:12 AM, David Chelimsky
Alex Chaffee - alex@stinky.com |
So I have this kinda crazy idea for integrating wrong with rspec:
The idea is that, if configured to do so, rspec would forward the block passed to
it
toassert
(or maybe wrong could expose a function to support similar w/o having to include anything). This way you don't even need to fuss over "assert" v "expect" - the block passed toit
has to conform to the same rules as a block passed to wrong'sassert
.As a preliminary experiment, I tried this:
When I ran this I got the following output:
As you can see, wrong does a great job of providing feedback for the example with the single line block, but the feedback for the multi-line block is a bit useless. So the question is: can wrong be modified to only care about the last statement in the block? Of course, the other question is: do you think this idea is interesting enough to try to make it happen?
The text was updated successfully, but these errors were encountered: