From b7f58d96cbc5ff4c2954976f65adbf18930ce810 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 23 Jul 2012 12:17:32 -0500 Subject: Compare md5s of dbs --- test/test_classifier.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_classifier.rb b/test/test_classifier.rb index 80df7e7..0571f85 100644 --- a/test/test_classifier.rb +++ b/test/test_classifier.rb @@ -2,6 +2,7 @@ require 'linguist/classifier' require 'linguist/language' require 'linguist/sample' require 'linguist/tokenizer' +require 'linguist/md5' require 'test/unit' @@ -17,8 +18,11 @@ class TestClassifier < Test::Unit::TestCase end def test_instance_freshness + serialized = Linguist::MD5.hexdigest(Classifier.instance.to_hash) + latest = Linguist::MD5.hexdigest(Linguist::Sample.classifier.to_hash) + # Just warn, it shouldn't scare people off by breaking the build. - unless Classifier.instance.eql?(Linguist::Sample.classifier) + if serialized != latest warn "Classifier database is out of date. Run `bundle exec rake classifier`." end end -- cgit v1.2.3