minicomic-backend/tests/TestTempBitmapToWeb.rb
2010-01-10 21:54:20 -05:00

35 lines
817 B
Ruby

require 'rubygems'
require 'test/unit'
require 'mocha'
require File.dirname(__FILE__) + '/../classes/TempBitmapToWeb.rb'
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}',
'date_format' => '%Y-%m-%d',
'publish_dates' => [ Date.parse('2010-01-01') ]
}
assert_equal 'test2010-01-01', @filter.filename({'index' => 0})
end
end