spec/spec_helper.rb in carrierwave-base64-2.7.0 vs spec/spec_helper.rb in carrierwave-base64-2.8.0

- old
+ new

@@ -12,11 +12,10 @@ require 'carrierwave/orm/activerecord' require 'carrierwave/mongoid' require 'carrierwave/base64' -ActiveRecord::Base.raise_in_transactional_callbacks = true ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ':memory:' ) @@ -27,5 +26,17 @@ def file_path(*paths) File.expand_path(File.join(File.dirname(__FILE__), *paths)) end CarrierWave.root = '' + +# Add preferred file types similar to how users would implement custom types +content_types = { + 'audio/mpeg' => 'mp3' +} +content_types.each do |content_type, extension| + MIME::Types.add( + MIME::Type.new(content_type).tap do |type| + type.preferred_extension = extension + end + ) +end