I have used a before(:all) to create some objects in the database and an after(:all) block to destroy them but I see that using before blocks and after blocks are a bad practice. Any reasons for this?
I need to destroy them because I have a presence validation of email on them.
Can you link to something that says they’re a bad practice?
I don’t have any problem with them as tools, in general.
That said, needing to manually destroy objects during your test’s teardown phase seems like a smell. You should be able to get the whole database cleaned for you automatically. Not sure why something like database_cleaner can’t solve that for you.