Ask a Question
Back to All


There is an AfterEachSpec, but no matching BeforeEachSpec. Given and When seem to run once per fixture if I'm not mistaken, or at least they appear to be working that way. I have a specific mock that I want to set up differently for one test. Yes, I know that's technically a new context, and I should build a new fixture, but that's would be so heavy in this case that I opted for a simpler text fixture with the individual tests taking some responsibility for tweaking the mocks. Don't you judge me... stop looking at me like that! I am NOT doing it wrong! Okay, fine, I'm doing it wrong. Anyway, I'm seeing the mock behavior bleed over from one test to another depending on their execution order. What I'd like is to set up the 99% behavior in a BeforeEachSpec, and tweak it in just the one test that deviates.