aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_storage_overview.md
diff options
context:
space:
mode:
authorJeremy Prevost <jprevost@mit.edu>2018-02-15 16:30:15 -0500
committerJeremy Prevost <jprevost@mit.edu>2018-02-15 16:30:15 -0500
commitb6bbedf1a8f12fdc8814acb547a36640814f22ca (patch)
tree98284c08e5f2928982298bd6574c48c6aad43934 /guides/source/active_storage_overview.md
parent590d89f793bf7a3d8a133cfc3eaa8fee9cbae87c (diff)
downloadrails-b6bbedf1a8f12fdc8814acb547a36640814f22ca.tar.gz
rails-b6bbedf1a8f12fdc8814acb547a36640814f22ca.tar.bz2
rails-b6bbedf1a8f12fdc8814acb547a36640814f22ca.zip
ActiveStorage file cleanup in Integration Tests
Documents ActiveStorage file cleanup in Integration Tests which is similar but slightly different than the existing docs for System Tests.
Diffstat (limited to 'guides/source/active_storage_overview.md')
-rw-r--r--guides/source/active_storage_overview.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md
index 97c56dfd93..c72a38b1de 100644
--- a/guides/source/active_storage_overview.md
+++ b/guides/source/active_storage_overview.md
@@ -556,6 +556,30 @@ config.active_job.queue_adapter = :inline
config.active_storage.service = :local_test
```
+Discarding Files Stored During Integration Tests
+-------------------------------------------
+
+Similarly to System Tests, files uploaded during Integration Tests will not be
+automatically cleaned up. If you want to clear the files, you can do it in an
+`after_teardown` callback. Doing it here ensures that all connections created
+during the test are complete and you won't receive an error from Active Storage
+saying it can't find a file.
+
+```ruby
+module ActionDispatch
+ class IntegrationTest
+ def remove_uploaded_files
+ FileUtils.rm_rf(Rails.root.join('tmp', 'storage'))
+ end
+
+ def after_teardown
+ super
+ remove_uploaded_files
+ end
+ end
+end
+```
+
Implementing Support for Other Cloud Services
---------------------------------------------