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.
This commit is contained in:
parent
052fcef0cb
commit
36e0ac3b53
@ -29,9 +29,4 @@ class ActiveStorage::Analyzer::ImageAnalyzerTest < ActiveSupport::TestCase
|
||||
assert_equal 792, metadata[:width]
|
||||
assert_equal 584, metadata[:height]
|
||||
end
|
||||
|
||||
private
|
||||
def extract_metadata_from(blob)
|
||||
blob.tap(&:analyze).metadata
|
||||
end
|
||||
end
|
||||
|
@ -51,9 +51,4 @@ class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase
|
||||
metadata = extract_metadata_from(blob)
|
||||
assert_equal({ "analyzed" => true, "identified" => true }, metadata)
|
||||
end
|
||||
|
||||
private
|
||||
def extract_metadata_from(blob)
|
||||
blob.tap(&:analyze).metadata
|
||||
end
|
||||
end
|
||||
|
@ -75,6 +75,10 @@ def directly_upload_file_blob(filename: "racecar.jpg", content_type: "image/jpeg
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user