Sequence of changes to make ordering of setups relative to setup_onces (and teardowns relative to teardown_onces) more intuitively correct, and improve exception handling.
Given the complexity of the logic, it may be worthwhile adding more in-depth unit tests now or soon. Let me know your thoughts.
Changing scope's test running algorithm to recursively walk down from…
… the outermost context to the innermost.
This ensures that setup/setup_once and teardown/teardown_once blocks will be run in an intuitive (alternating) order.
Adding exception handling to intermediate contexts when running tests.
Fixing test running to run the teardown_once block whenever the last …
…actual test in a given context is run, even if there are subsequent empty contexts.
Merge remote-tracking branch 'upstream/master'
Updating Scope test for setup_once/setup ordering changes.
I wonder if it's worth it to have every context have a default empty setup and teardown proc so we don't have all of these trailing "if outer_context.teardown_once" everywhere. What do you think?
A slight improvement would be add the short circuit "return @name_of_last_test if defined? (@name_of_last_test).
It would also be nice to explain strategically, why this method is necessary. I think you can get rid of these break statements if you use "find" instead of "each".
Thanks harob, this is awesome. Pulling it in. Have a look at the tweaks I suggested when you get a chance.