diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_storage_overview.md | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md index 65d4e2934f..51f50e8931 100644 --- a/guides/source/active_storage_overview.md +++ b/guides/source/active_storage_overview.md @@ -742,16 +742,22 @@ during the test are complete and you won't receive an error from Active Storage saying it can't find a file. ```ruby +module RemoveUploadedFiles + def after_teardown + super + remove_uploaded_files + end + + private + + def remove_uploaded_files + FileUtils.rm_rf(Rails.root.join('tmp', 'storage')) + end +end + 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 + prepend RemoveUploadedFiles end end ``` |