mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
28 lines
958 B
Ruby
28 lines
958 B
Ruby
require "bundler/setup"
|
|
require "active_support"
|
|
require "active_support/test_case"
|
|
require "active_support/testing/autorun"
|
|
require "byebug"
|
|
|
|
require "active_storage"
|
|
|
|
require "active_storage/service"
|
|
ActiveStorage::Blob.service = ActiveStorage::Service.configure(:Disk, root: File.join(Dir.tmpdir, "active_storage"))
|
|
|
|
require "active_storage/verified_key_with_expiration"
|
|
ActiveStorage::VerifiedKeyWithExpiration.verifier = ActiveSupport::MessageVerifier.new("Testing")
|
|
|
|
class ActiveSupport::TestCase
|
|
private
|
|
def create_blob(data: "Hello world!", filename: "hello.txt", content_type: "text/plain")
|
|
ActiveStorage::Blob.create_after_upload! io: StringIO.new(data), filename: filename, content_type: content_type
|
|
end
|
|
end
|
|
|
|
|
|
require "active_storage/attached"
|
|
ActiveRecord::Base.send :extend, ActiveStorage::Attached::Macros
|
|
|
|
require "global_id"
|
|
GlobalID.app = "ActiveStorageExampleApp"
|
|
ActiveRecord::Base.send :include, GlobalID::Identification
|