Warn if classifier instance is out of date

This commit is contained in:
Joshua Peek
2012-06-19 14:32:04 -05:00
parent e2b0f6bb50
commit ddf3ec4a5b
2 changed files with 20 additions and 0 deletions

View File

@@ -16,6 +16,13 @@ class TestClassifier < Test::Unit::TestCase
File.read(File.join(fixtures_path, name))
end
def test_instance_freshness
# Just warn, it shouldn't scare people off by breaking the build.
unless Classifier.instance.eql?(Linguist::Sample.classifier)
warn "Classifier database is out of date. Run `bundle exec rake classifier`."
end
end
def test_classify
classifier = Classifier.new
classifier.train Language["Ruby"], fixture("ruby/foo.rb")