Closed seansu4you87 closed 8 years ago
The problem is here: https://github.com/sproutapp/pavlov/blob/master/lib/case.ex#L253
We flush the ResultTable
before each it
. Instead we need to somehow flush before the before
statements are run if there are any. This is actually fairly complicated because before an it
statement, we need:
before(:each)
statements to be re-executed and retain memosbefore(:all)
statements should not reference let
assignments. See the following rspec error as an example: let declaration `hello` accessed in a `before(:context)` hook at:
I'm going to try and see if I can figure out where the callbacks are run, and flush it before that point, thus evaluated lets can retain their memos
Hi! Thanks for investigating this bug in such depth :).
It seems like just flushing it after the examples are run fixed the issue then, or am I missing something else?
Thank you for the contribution! I'll run some more tests when I get home tonight but your solution looks good to me!
Hey @inf0rmer, I don't quite remember all the details of what I was saying here, but I remember that the issue isn't fixed.
I'm trying to utilize the very handle rspec feature, where you declare all of your dependencies in let
statements, which are lazily executed. This way you can override those let statements deep in yoru nesting, when you need to slightly modify part of your set up.
Thanks for looking it over again!
Gonna close this out for now. Feel free to open it back up if you have time!
Here's a failing spec for https://github.com/sproutapp/pavlov/issues/46
Not sure on how to properly implement this