aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/test_helper.rb
diff options
context:
space:
mode:
authorRicardo Díaz <ricardotk002@gmail.com>2018-04-25 15:28:30 -0500
committerRicardo Díaz <ricardotk002@gmail.com>2018-04-25 15:28:30 -0500
commit36e0ac3b5357534ecf147d445f19a837b5a96e4b (patch)
treec6b03b08664de41c2d9778301ffa425312afbf52 /activestorage/test/test_helper.rb
parent052fcef0cb405a3fa3a46349a9d979c2e0d4c160 (diff)
downloadrails-36e0ac3b5357534ecf147d445f19a837b5a96e4b.tar.gz
rails-36e0ac3b5357534ecf147d445f19a837b5a96e4b.tar.bz2
rails-36e0ac3b5357534ecf147d445f19a837b5a96e4b.zip
Move #extract_metadata_from to ActiveStorage's TestHelper
ImageAnalyzerTest and VideoAnalyzerTest are defining the same helper, since both use `#create_file_blob` that is defined in TestHelper, it makes sense to move `#extract_metadata_from` to that side.
Diffstat (limited to 'activestorage/test/test_helper.rb')
-rw-r--r--activestorage/test/test_helper.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb
index 4787eccd09..499d955a2f 100644
--- a/activestorage/test/test_helper.rb
+++ b/activestorage/test/test_helper.rb
@@ -75,6 +75,10 @@ class ActiveSupport::TestCase
def read_image(blob_or_variant)
MiniMagick::Image.open blob_or_variant.service.send(:path_for, blob_or_variant.key)
end
+
+ def extract_metadata_from(blob)
+ blob.tap(&:analyze).metadata
+ end
end
require "global_id"