Closed khataev closed 1 year ago
This is my workaround
class Uploaders::Base < CarrierWave::Uploader::Base
STORAGE = (Rails.env.test? ? :file : :aws).freeze
storage STORAGE
end
stub_responses: Rails.env.test? # Optional, avoid hitting S3 actual during tests
Obviously, this disables the API interaction and requests will no longer reach S3. Set it to false
when you don't need.
https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/stubbing.html
This is my configuration:
model:
uploader:
this is how I setup file and factory in a test:
when I try to read file's contents it returns empty string:
How to fix it?
On other project that used pure
fog-carrierwave
we did something like here , in test environment we do not use AWS, we use file storage.With carrierwave-aws it does not work, I get an error, that bucket name is not set. So my question how to set test env config properly, ideally to use file storage and to be able to download/get file and its contents. Thanks!