diff options
Diffstat (limited to 'activestorage/test/analyzer')
-rw-r--r-- | activestorage/test/analyzer/image_analyzer_test.rb | 10 | ||||
-rw-r--r-- | activestorage/test/analyzer/video_analyzer_test.rb | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/activestorage/test/analyzer/image_analyzer_test.rb b/activestorage/test/analyzer/image_analyzer_test.rb index 9087072215..0d9f24c5c1 100644 --- a/activestorage/test/analyzer/image_analyzer_test.rb +++ b/activestorage/test/analyzer/image_analyzer_test.rb @@ -6,11 +6,19 @@ require "database/setup" require "active_storage/analyzer/image_analyzer" class ActiveStorage::Analyzer::ImageAnalyzerTest < ActiveSupport::TestCase - test "analyzing an image" do + test "analyzing a JPEG image" do blob = create_file_blob(filename: "racecar.jpg", content_type: "image/jpeg") metadata = blob.tap(&:analyze).metadata assert_equal 4104, metadata[:width] assert_equal 2736, metadata[:height] end + + test "analyzing an SVG image without an XML declaration" do + blob = create_file_blob(filename: "icon.svg", content_type: "image/svg+xml") + metadata = blob.tap(&:analyze).metadata + + assert_equal 792, metadata[:width] + assert_equal 584, metadata[:height] + end end diff --git a/activestorage/test/analyzer/video_analyzer_test.rb b/activestorage/test/analyzer/video_analyzer_test.rb index b3b9c97fe4..7fc1cfce06 100644 --- a/activestorage/test/analyzer/video_analyzer_test.rb +++ b/activestorage/test/analyzer/video_analyzer_test.rb @@ -30,6 +30,6 @@ class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase test "analyzing a video without a video stream" do blob = create_file_blob(filename: "video_without_video_stream.mp4", content_type: "video/mp4") - assert_equal({ "analyzed" => true }, blob.tap(&:analyze).metadata) + assert_equal({ "analyzed" => true, "identified" => true }, blob.tap(&:analyze).metadata) end end |