BeforeEachSpec?

Solved!
Posted in General by Mel Grubb Tue Jan 05 2016 16:02:24 GMT+0000 (UTC)·3·Viewed 325 times

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.
Matt Honeycutt
Jan 6, 2016

There isn't a BeforeEachSpec yet, but I don't see the harm in adding one. I'll try to work on this later in the week.

Matt Honeycutt
Jan 8, 2016

I'm adding a new AfterEachTest method, which will be in the release later today. :)


Matt Honeycutt marked this as solved
Mel Grubb
Jan 9, 2016

Awesome! Thanks. I'll update and give it a spin.

Markdown is allowed