Skip to content

Isolate CarrierWave uploads in test enviroment

Grzegorz Bizon requested to merge tests/isolate-carrierwave-uploads into master

Purpose of this merge request is to isolate CarrierWave uploads in test environment, from regular development/production uploads. We need to persist some files in order to test some features thoroughly. If we - for example - want to check if file exists after being uploaded via API, or we need to write tests that check if file has been correctly removed we need to persist uploads using CarrierWave.

This approach simply sets root path for uploads in test environment and removes temporary directory after executing RSpec tests suite. We set this in spec_helper to keep this in one place, this also can be set up in test environment initializer.

This issue is a workaround for #12968 (closed), but does not solve this problem completely, because if uploader defines absolute path in store_dir or defines custom root path, this may not work correctly (but it looks like we do have such uploaders at this moment).

Merge request reports