test/test_makerhelper.rb in review-1.1.0 vs test/test_makerhelper.rb in review-1.2.0

- old
+ new

@@ -28,23 +28,39 @@ touch_file("#{@tmpdir1}/subdir/foo.png") image_files = MakerHelper.copy_images_to_dir(@tmpdir1, @tmpdir2) types.each do |type| - assert File.exists?("#{@tmpdir2}/foo.#{type}"), "Copying #{type} file failed" + assert File.exist?("#{@tmpdir2}/foo.#{type}"), "Copying #{type} file failed" assert image_files.include?("#{@tmpdir1}/foo.#{type}") end - assert File.exists?("#{@tmpdir2}/subdir/foo.png"), "Copying a image file in a subdirectory" + assert File.exist?("#{@tmpdir2}/subdir/foo.png"), "Copying a image file in a subdirectory" assert image_files.include?("#{@tmpdir1}/subdir/foo.png") end def test_copy_images_to_dir_convert touch_file("#{@tmpdir1}/foo.eps") image_files = MakerHelper.copy_images_to_dir(@tmpdir1, @tmpdir2, :convert => {:eps => :png}) - assert File.exists?("#{@tmpdir2}/foo.eps.png"), "EPS to PNG conversion failed" + assert File.exist?("#{@tmpdir2}/foo.eps.png"), "EPS to PNG conversion failed" assert image_files.include?("#{@tmpdir1}/foo.eps.png") + end + + def test_copy_images_to_dir_with_exts + types = %w{png gif jpg jpeg svg pdf eps} + types4epub = %w{png gif jpg jpeg svg} + types.each do |type| + touch_file("#{@tmpdir1}/foo.#{type}") + end + image_files = MakerHelper.copy_images_to_dir(@tmpdir1, @tmpdir2, :exts=>types4epub) + + types4epub.each do |type| + assert image_files.include?("#{@tmpdir1}/foo.#{type}"), "foo.#{type} is not included" + end + (types - types4epub).each do |type| + assert !image_files.include?("#{@tmpdir1}/foo.#{type}"), "foo.#{type} is included" + end end end