minicomic-backend/test/temp_bitmap_to_web_test.rb

32 lines
764 B
Ruby
Raw Normal View History

2010-09-12 13:16:44 +00:00
require 'test_helper'
require 'minicomic-backend/temp_bitmap_to_web'
2010-01-07 03:56:52 +00:00
class TestTempBitmapToWeb < Test::Unit::TestCase
def setup
@filter = TempBitmapToWeb.new
@filter.stubs(:convert_pixels)
end
def test_build
[
[ nil, 80 ],
[ 75, 75 ]
]. each do |quality, expected_quality|
@filter.expects(:convert).with("\"file\" -quality #{expected_quality} \"outfile\"")
@filter.config = {
'quality' => quality
}
@filter.build('file', 'outfile')
end
end
def test_filename
@filter.config = {
'target' => 'test{date}',
2010-01-11 02:54:20 +00:00
'date_format' => '%Y-%m-%d',
'publish_dates' => [ Date.parse('2010-01-01') ]
2010-01-07 03:56:52 +00:00
}
assert_equal 'test2010-01-01', @filter.filename({'index' => 0})
end
end