Fix for fixture tests: fixture files were not tested at all

This commit is contained in:
Paul Chaignon
2014-12-02 20:26:15 -05:00
parent 4ddd8d9d2b
commit e5bc2845cd

View File

@@ -469,16 +469,16 @@ class TestBlob < Test::Unit::TestCase
# Test language detection for files which shouldn't be used as samples
root = File.expand_path('../fixtures', __FILE__)
Dir.entries(root).each do |language|
next unless File.file?(language)
next if language == '.' || language == '..'
# Each directory contains test files of a language
dirname = File.join(root, language)
Dir.entries(dirname).each do |filename|
next unless File.file?(filename)
# By default blob search the file in the samples;
# thus, we need to give it the absolute path
filepath = File.join(dirname, filename)
next unless File.file?(filepath)
blob = blob(filepath)
assert blob.language, "No language for #{filepath}"
assert_equal language, blob.language.name, blob.name