aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-21 16:34:18 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-21 16:34:18 -0500
commit08d84e225cca6772aa54dfb7123120fe1070ea30 (patch)
tree6072999648420a121078ac0acdac92e39a257328 /test/test_helper.rb
parentb6fd579a7e97f1a3aee27d22e12784f7a6155799 (diff)
downloadrails-08d84e225cca6772aa54dfb7123120fe1070ea30.tar.gz
rails-08d84e225cca6772aa54dfb7123120fe1070ea30.tar.bz2
rails-08d84e225cca6772aa54dfb7123120fe1070ea30.zip
Extract test helper for image blob fixtures
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 7aa7b50bf3..69ba76b9c4 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -33,6 +33,12 @@ class ActiveSupport::TestCase
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
+
+ def create_image_blob(filename: "racecar.jpg", content_type: "image/jpeg")
+ ActiveStorage::Blob.create_after_upload! \
+ io: File.open(File.expand_path("../fixtures/files/#{filename}", __FILE__)),
+ filename: filename, content_type: content_type
+ end
end
require "action_controller"