diff options
author | Ricardo Díaz <ricardotk002@gmail.com> | 2018-04-25 15:28:30 -0500 |
---|---|---|
committer | Ricardo Díaz <ricardotk002@gmail.com> | 2018-04-25 15:28:30 -0500 |
commit | 36e0ac3b5357534ecf147d445f19a837b5a96e4b (patch) | |
tree | c6b03b08664de41c2d9778301ffa425312afbf52 /activestorage | |
parent | 052fcef0cb405a3fa3a46349a9d979c2e0d4c160 (diff) | |
download | rails-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')
-rw-r--r-- | activestorage/test/analyzer/image_analyzer_test.rb | 5 | ||||
-rw-r--r-- | activestorage/test/analyzer/video_analyzer_test.rb | 5 | ||||
-rw-r--r-- | activestorage/test/test_helper.rb | 4 |
3 files changed, 4 insertions, 10 deletions
diff --git a/activestorage/test/analyzer/image_analyzer_test.rb b/activestorage/test/analyzer/image_analyzer_test.rb index f8a38f001a..55bb5e7280 100644 --- a/activestorage/test/analyzer/image_analyzer_test.rb +++ b/activestorage/test/analyzer/image_analyzer_test.rb @@ -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 diff --git a/activestorage/test/analyzer/video_analyzer_test.rb b/activestorage/test/analyzer/video_analyzer_test.rb index 2612006551..d30f49315a 100644 --- a/activestorage/test/analyzer/video_analyzer_test.rb +++ b/activestorage/test/analyzer/video_analyzer_test.rb @@ -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 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" |