test/test_git.rb in hoc-0.4.2 vs test/test_git.rb in hoc-0.5
- old
+ new
@@ -44,24 +44,44 @@
echo 'good bye, world!' > test.txt
git commit -am 'modify line'
rm test.txt
git commit -am 'delete line'
")
- hits = HOC::Git.new(dir).hits
+ hits = HOC::Git.new(dir, []).hits
assert_equal 1, hits.size
assert_equal 4, hits[0].total
end
end
def test_parsing_with_empty_git
- skip('fails now')
Dir.mktmpdir 'test' do |dir|
fail unless system("
set -e
cd '#{dir}'
git init .
")
- hits = HOC::Git.new(dir).hits
+ hits = HOC::Git.new(dir, []).hits
+ assert_equal 1, hits.size
+ assert_equal 0, hits[0].total
+ end
+ end
+
+ def test_ignores_binary_files
+ Dir.mktmpdir 'test' do |dir|
+ fail unless system("
+ set -e
+ cd '#{dir}'
+ git init .
+ git config user.email test@teamed.io
+ git config user.name test
+ dd if=/dev/random of=test.dat bs=1 count=65536
+ git add test.dat
+ git commit -am 'binary file'
+ dd if=/dev/random of=test.dat bs=1 count=65536
+ git add test.dat
+ git commit -am 'binary file modified'
+ ")
+ hits = HOC::Git.new(dir, []).hits
assert_equal 1, hits.size
assert_equal 0, hits[0].total
end
end
end