Currently, execution contexts are shared among all examples in a group, even among non-sibling examples, so the following fails twice:
with description('top level'):
with context('first group'):
with it('an example'):
self.value = 10
with it('a second example'):
expect(self).not_to(have_property('value'))
with context('second group'):
with it('another example'):
expect(self).not_to(have_property('value'))
I believe each example should be given its own execution context. That way, we can enforce a bit more test independence. Having this would mean running all hooks once per example, and I don't see a straightforward way to do it with the current relationship betwen Example and ExampleGroup.
Do you think this behaviour is desirable? Or do you think it's fine to share execution contexts?
Currently, execution contexts are shared among all examples in a group, even among non-sibling examples, so the following fails twice:
I believe each example should be given its own execution context. That way, we can enforce a bit more test independence. Having this would mean running all hooks once per example, and I don't see a straightforward way to do it with the current relationship betwen Example and ExampleGroup.
Do you think this behaviour is desirable? Or do you think it's fine to share execution contexts?