When running feature Rspecs, I receive the following error (full trace at the bottom of this message)
Rack app error handling request {
Something is likely off with how you're setting up the image that you're testing against. You might want to update that to how the Rails team handles it in their own tests:
module ActiveStorageHelpers
# ported from https://github.com/rails/rails/blob/5-2-stable/activestorage/test/test_helper.rb#L57
def create_file_blob(filename: "image.jpg", content_type: "image/jpeg", metadata: nil)
ActiveStorage::Blob.create_after_upload! io: file_fixture(filename).open, filename: filename, content_type: content_type, metadata: metadata
end
end
RSpec.configure do |config|
config.include ActiveStorageHelpers
end
Then place a tiny image file in spec/fixtures/file/images.jpg (that's where the file_fixture method will look for it).
With that in place, you can setup the image on your model in your feature test with something like:
instance_of_model.images.attach(create_file_blob)