Using DatabaseCleaner with rspec and Shrine

I’ve been using Shrine for years, and I really like it - I even think I’m pretty good at using it. But I’ve been learning that I am going about testing all wrong - I’ve been using rspec with config.use_transactional_fixtures = true this whole time even though the testing doc very specifically says not to do that. It seemed to be working, but I had been oblivious to how my minio server was clogging up with test data.

I would like very much to start doing this the right way, to avoid clogging up minio, and generally not do things the wrong way. I haven’t been having a lot of luck finding examples though and I could really use a hand as far as where to look.

Here’s what we’re doing - we are using s3 for storage with the presign_endpoint plugin to enable uppy uploading. Because of the presign endpoint I don’t think we can use a memory store in test, so we are using minio as a destination for testing.

I figure that at a minimum I need to disable transactional fixtures and switch over to using DatabaseCleaner. Is there a preferred strategy to use with it? And do I need to explicitly tear down my test data in each test, or will DatabaseCleaner’s cleanup handle that? (I am guessing I need to handle teardown myself?)

Alternatively, we could look into stubbing s3 and removing minio from the equation, but I think we would probably need to stub out so much functionality that our suite would suffer.

Anyway - if anyone could point me towards some best practices, I would greatly appreciate it!