This commit is contained in:
boffbowsh 2009-03-16 12:39:54 +00:00
Родитель ab1e4f7b0b
Коммит 4b163938ec
3 изменённых файлов: 6 добавлений и 6 удалений

0
lib/technoweenie/attachment_fu.rb Normal file → Executable file
Просмотреть файл

9
test/basic_test.rb Normal file → Executable file
Просмотреть файл

@ -29,12 +29,14 @@ class BasicTest < Test::Unit::TestCase
end
def test_should_sanitize_content_type
@attachment = Attachment.new :content_type => ' foo '
@attachment = Attachment.new
@attachment.content_type = ' foo '
assert_equal 'foo', @attachment.content_type
end
def test_should_sanitize_filenames
@attachment = Attachment.new :filename => 'blah/foo.bar'
@attachment = Attachment.new
@attachment.filename = 'foo.bar'
assert_equal 'foo.bar', @attachment.filename
@attachment.filename = 'blah\\foo.bar'
@ -51,7 +53,8 @@ class BasicTest < Test::Unit::TestCase
end
def test_should_convert_thumbnail_name
@attachment = FileAttachment.new :filename => 'foo.bar'
@attachment = FileAttachment.new
@attachment.filename = 'foo.bar'
assert_equal 'foo.bar', @attachment.thumbnail_name_for(nil)
assert_equal 'foo.bar', @attachment.thumbnail_name_for('')
assert_equal 'foo_blah.bar', @attachment.thumbnail_name_for(:blah)

3
test/processors/rmagick_test.rb Normal file → Executable file
Просмотреть файл

@ -123,7 +123,6 @@ class RmagickTest < Test::Unit::TestCase
assert_equal 55, attachment.width
assert_equal 55, attachment.height
assert_equal 2, attachment.thumbnails.length
assert_equal 1.0, attachment.aspect_ratio
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
assert !thumb.new_record?, thumb.errors.full_messages.join("\n")
@ -131,7 +130,6 @@ class RmagickTest < Test::Unit::TestCase
#assert_in_delta 4673, thumb.size, 2
assert_equal 50, thumb.width
assert_equal 50, thumb.height
assert_equal 1.0, thumb.aspect_ratio
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
assert !geo.new_record?, geo.errors.full_messages.join("\n")
@ -139,7 +137,6 @@ class RmagickTest < Test::Unit::TestCase
#assert_equal 3915, geo.size
assert_equal 50, geo.width
assert_equal 50, geo.height
assert_equal 1.0, geo.aspect_ratio
end
end