I recently upgraded from Carrierwave 1.3 to 2.1, and I got a couple of specs failing due to the invalid mime type.
I store on the database, CSV Uploads, and I validate on the model if the mime type is text/csv.
validates :file, presence: true, file_content_type: {
allow: [
'text/csv',
'application/vnd.ms-excel',
'application/vnd.ms-office',
'application/octet-stream',
'text/comma-separated-values'
]
}
and on the spec, I created a fixture
let(:file) { fixture_file_upload('files/fixture.csv', 'text/csv') }
when I debug,
@file=
#<CarrierWave::SanitizedFile:0x00007f8c731791f0
@content=nil,
@content_type="invalid/invalid",
@file="/Users/tiagovieira/code/work/tpc/public/uploads/csv_file_upload/file/1/1605532759-308056149220914-0040-7268/fixture.csv",
@original_filename="fixture.csv">,
@filename="fixture.csv",
@identifier="fixture.csv",
Is this related to the fact that carrierwave stopped using mime-types gem as a dependency?