start using code covrage

This commit is contained in:
John Bintz 2010-01-05 07:28:52 -05:00
parent 8e16d7cc00
commit dbd73b1126
4 changed files with 37 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
*~
.loadpath
.project
.DS_Store
coverage/

View File

@ -1,4 +1,7 @@
.PHONY : test
.PHONY : test test-coverage
test :
testrb -b tests/*
test-coverage :
rcov -x '\/jruby\/lib\/' -x '\/tests\/data\/' tests/*.rb

View File

@ -1,11 +1,11 @@
require 'rubygems'
require 'test/unit'
require 'mockfs/override'
require 'fakefs/safe'
require File.dirname(__FILE__) + '/../classes/Filter.rb'
class TestFilter < Test::Unit::TestCase
def setup
@filter = Filter.instance
@filter = Filter.new
end
def test_recalc_pixels
@ -41,5 +41,34 @@ class TestFilter < Test::Unit::TestCase
}
assert_equal(10, @filter.config['width'])
end
@filter.config = {
'print' => true,
'dpi' => 10,
'width_inches' => 1,
'height_inches' => 2
}
assert_equal(10, @filter.config['width'])
assert_equal(20, @filter.config['height'])
end
def test_cleanup
@filter.cleanup = [ 'test', 'test2', 'test3' ]
FakeFS do
FileUtils.touch [ 'test', 'test3', 'test4' ]
@filter.cleanup
[ 'test', 'test2', 'test3' ].each do |file|
assert !(File.exists? file)
end
[ 'test4' ].each do |file|
assert File.exists? file
end
end
end
def test_get_dimensions
assert_equal [ 50, 75 ], @filter.get_dimensions(File.dirname(__FILE__) + '/data/test_dimensions.png')
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B