From f2935b399be87d7acfc6067a73cfe11e7d4bbdec Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Mon, 10 Dec 2018 18:20:23 -0500 Subject: Prepend module in ActiveStorage overview [ci skip] --- guides/source/active_storage_overview.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'guides/source/active_storage_overview.md') 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 ``` -- cgit v1.2.3