lib/decidim/dev/test/rspec_support/attachment_helpers.rb in decidim-dev-0.28.4 vs lib/decidim/dev/test/rspec_support/attachment_helpers.rb in decidim-dev-0.29.0.rc1
- old
+ new
@@ -12,13 +12,15 @@
# Creates ActiveStorage::Blob object and returns its signed_id
# Used in non-system tests that need files.
def upload_test_file(file, options = {})
filename = options[:filename] || upload_test_file_filename(file)
+ content_type = options[:content_type] || upload_test_file_content_type(file)
blob = ActiveStorage::Blob.create_and_upload!(
io: File.open(file),
- filename:
+ filename:,
+ content_type:
)
return blob if options[:return_blob]
blob.signed_id
end