diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-07-07 23:25:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-07 23:25:33 -0400 |
commit | e8682c5bf051517b0b265e446aa1a7eccfd47bf7 (patch) | |
tree | cc04c8a28113bc0fa3748fdc6035d487e3e16af7 /activestorage/test/test_helper.rb | |
parent | 0b534cd1c814a4db2d0aa283981f1d55e5e62d25 (diff) | |
download | rails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.tar.gz rails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.tar.bz2 rails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.zip |
Store newly-uploaded files on save rather than assignment
Diffstat (limited to 'activestorage/test/test_helper.rb')
-rw-r--r-- | activestorage/test/test_helper.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb index 9985a76832..7b7926ac79 100644 --- a/activestorage/test/test_helper.rb +++ b/activestorage/test/test_helper.rb @@ -79,6 +79,10 @@ class ActiveSupport::TestCase def extract_metadata_from(blob) blob.tap(&:analyze).metadata end + + def fixture_file_upload(filename) + Rack::Test::UploadedFile.new file_fixture(filename).to_s + end end require "global_id" @@ -86,6 +90,8 @@ GlobalID.app = "ActiveStorageExampleApp" ActiveRecord::Base.send :include, GlobalID::Identification class User < ActiveRecord::Base + validates :name, presence: true + has_one_attached :avatar has_one_attached :cover_photo, dependent: false |