Add before test hook #25

Closed
wants to merge 6 commits into
from

Projects

None yet

3 participants

cbarton commented Jun 22, 2011

For specific cases, there might be some caching issues when a test is run, for example in our application we use fixture data and transactional fixtures. After a test runs there is a chance that the global fixtures recognize the fixtures as in the database when they are not due to the natural parallelism experienced. With this in mind, before each test we must clear out the fixture cache that active record creates.

Enter the before_test hook where we can specify to clean out the cache and it works!

Collaborator
l4rk commented Jun 22, 2011

Thanks for the pull request. @leshill and I will take a look this Friday afternoon.

Chris Barton added some commits Jun 23, 2011
Owner
sandro commented Jun 23, 2011

Can't you use rspec's before and after hooks?

Owner
sandro commented Jun 23, 2011

How does Lane's formatter relate to your original "before_test" pull request? What benefits does this new formatter present?

cbarton commented Jun 23, 2011

This is true.. good point sir. And sorry about the bad merge, meant for it to be another branch.

@cbarton cbarton closed this Jun 23, 2011
Owner
sandro commented Jun 23, 2011

The major difference is that your before_test hook gets run before each file, rather than before each spec. However, I think it's a good idea for your test suite to be able to run independently of specjour, which is why I recommend using rspec's hooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment