aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-02-16 11:17:51 -0500
committerGitHub <noreply@github.com>2018-02-16 11:17:51 -0500
commitd2571f517314a12763bdef945a6cbe8c4f5ecb63 (patch)
treef8d7fa86007cf7b808296655a81e9001bd4bd14e /guides
parent7286d81312be3be925e6ba35823daa9910c6ab46 (diff)
parentb6bbedf1a8f12fdc8814acb547a36640814f22ca (diff)
downloadrails-d2571f517314a12763bdef945a6cbe8c4f5ecb63.tar.gz
rails-d2571f517314a12763bdef945a6cbe8c4f5ecb63.tar.bz2
rails-d2571f517314a12763bdef945a6cbe8c4f5ecb63.zip
Merge pull request #32015 from JPrevost/activestorage_integration_test_cleanup_docs
ActiveStorage file cleanup in Integration Tests
Diffstat (limited to 'guides')
-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
---------------------------------------------