0
@@ -20,14 +20,28 @@ class AssetTest < Test::Unit::TestCase
0
def test_should_upload_file
0
- assert_file_exists File.join(ASSET_PATH, now.year.to_s, now.month.to_s, now.day.to_s, 'logo.png')
0
- if Object.const_defined?(:Magick)
0
- assert_file_exists File.join(ASSET_PATH, now.year.to_s, now.month.to_s, now.day.to_s, 'logo_thumb.png')
0
- assert_file_exists File.join(ASSET_PATH, now.year.to_s, now.month.to_s, now.day.to_s, 'logo_tiny.png')
0
+ assert_assets_exist :logo
0
+ def test_should_rename_non_unique_filename
0
+ asset = process_upload
0
+ assert_equal 'logo.png', asset.filename
0
+ asset = process_upload
0
+ assert_equal 'logo_1.png', asset.filename
0
+ assert_assets_exist :logo_1
0
+ def test_should_rename_non_unique_filename_when_renaming
0
+ asset = process_upload
0
+ assert_equal 'logo.png', asset.filename
0
+ asset = process_upload(:filename => 'logo_reloaded.png')
0
+ assert_assets_exist :logo_reloaded, now
0
+ asset.update_attributes :filename => 'logo.png'
0
+ assert_file_exists File.join(ASSET_PATH, now.year.to_s, now.month.to_s, now.day.to_s, "logo_1.png")
0
def test_should_upload_file_in_multi_sites_mode
0
Site.multi_sites_enabled = true
0
@@ -158,4 +172,12 @@ class AssetTest < Test::Unit::TestCase
0
+ def assert_assets_exist(filename, created_at = Time.now.utc)
0
+ assert_file_exists File.join(ASSET_PATH, created_at.year.to_s, created_at.month.to_s, created_at.day.to_s, "#{filename}.png")
0
+ if Object.const_defined?(:Magick)
0
+ assert_file_exists File.join(ASSET_PATH, created_at.year.to_s, created_at.month.to_s, created_at.day.to_s, "#{filename}_thumb.png")
0
+ assert_file_exists File.join(ASSET_PATH, created_at.year.to_s, created_at.month.to_s, created_at.day.to_s, "#{filename}_tiny.png")
Comments
No one has commented yet.