Carrierwave + RSpec Test
I am testing that my file uploads are correct with models with RSpec by setting Model#filename = File.open(etc)
When my specs run, everything is great. But the files still remain in my public / uploads directory after testing is complete.
How do I get the files to be deleted at the end of the work along with the records?
Thank!
https://github.com/jnicklas/carrierwave/wiki/How-to:-Cleanup-after-your-Rspec-tests
One way is to remove them at the end of the test using an instance method that is called by the media. An example where your instance @user
and your carrier file attribute: avatar
would be:@user.remove_avatar!