|
|
@@ -4,33 +4,40 @@ class TestAsset < Minitest::Test
|
|
|
def setup
|
|
|
@jpg_path = File.expand_path("../fixtures/cockapoo.jpg", __FILE__)
|
|
|
@heic_path = File.expand_path("../fixtures/mammoth.heic", __FILE__)
|
|
|
+ @gif_path = File.expand_path("../fixtures/frog.gif", __FILE__)
|
|
|
@jpg_asset = Fotos::Asset.new(@jpg_path)
|
|
|
@heic_asset = Fotos::Asset.new(@heic_path)
|
|
|
+ @gif_asset = Fotos::Asset.new(@gif_path)
|
|
|
end
|
|
|
|
|
|
def test_initializes_with_file_path
|
|
|
assert_equal @jpg_path, @jpg_asset.file_path
|
|
|
assert_equal @heic_path, @heic_asset.file_path
|
|
|
+ assert_equal @gif_path, @gif_asset.file_path
|
|
|
end
|
|
|
|
|
|
def test_dirname_returns_parent_directory_name
|
|
|
assert_equal "fixtures", @jpg_asset.dirname
|
|
|
assert_equal "fixtures", @heic_asset.dirname
|
|
|
+ assert_equal "fixtures", @gif_asset.dirname
|
|
|
end
|
|
|
|
|
|
def test_file_name_returns_basename
|
|
|
assert_equal "cockapoo.jpg", @jpg_asset.file_name
|
|
|
assert_equal "mammoth.heic", @heic_asset.file_name
|
|
|
+ assert_equal "frog.gif", @gif_asset.file_name
|
|
|
end
|
|
|
|
|
|
def test_ext_name_returns_file_extension
|
|
|
assert_equal ".jpg", @jpg_asset.ext_name
|
|
|
assert_equal ".heic", @heic_asset.ext_name
|
|
|
+ assert_equal ".gif", @gif_asset.ext_name
|
|
|
end
|
|
|
|
|
|
def test_supported_returns_true_for_jpeg_jpg
|
|
|
assert @jpg_asset.supported?
|
|
|
- refute @heic_asset.supported?
|
|
|
+ assert @heic_asset.supported?
|
|
|
+ refute @gif_asset.supported?
|
|
|
end
|
|
|
|
|
|
def test_thumbnail_name_adds_prefix
|