rrbayes 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/rrbayes.gemspec +1 -1
- data/test/rrbayes_test.rb +7 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/rrbayes.gemspec
CHANGED
data/test/rrbayes_test.rb
CHANGED
@@ -2,24 +2,26 @@ require 'teststrap'
|
|
2
2
|
|
3
3
|
include Rrbayes
|
4
4
|
|
5
|
+
DB_NUM = 0
|
6
|
+
|
5
7
|
context "a new classifier" do
|
6
8
|
|
7
9
|
setup do
|
8
|
-
db = Redis.new :db =>
|
10
|
+
db = Redis.new :db => DB_NUM
|
9
11
|
db.connect_to_server
|
10
12
|
db.flushdb
|
11
|
-
@classifier = Classifier.new({:categories => %w(spam ham)}, :db =>
|
13
|
+
@classifier = Classifier.new({:categories => %w(spam ham)}, :db => DB_NUM)
|
12
14
|
end
|
13
15
|
|
14
16
|
should("persist categories") { topic.db.set_members('categories') }.equals %w(spam ham)
|
15
17
|
|
16
18
|
should("load categories") { topic.send(:load_categories) }.equals %w(spam ham)
|
17
19
|
|
18
|
-
should("initialize with no categories") { Classifier.new.categories.map { |c| c.name } }.equals %w(spam ham)
|
20
|
+
should("initialize with no categories") { Classifier.new({}, :db => DB_NUM).categories.map { |c| c.name } }.equals %w(spam ham)
|
19
21
|
|
20
|
-
should("initialize with same categories") { Classifier.new(:categories => %w(spam ham)).categories.map { |c| c.name } }.equals %w(spam ham)
|
22
|
+
should("initialize with same categories") { Classifier.new({:categories => %w(spam ham)}, :db => DB_NUM).categories.map { |c| c.name } }.equals %w(spam ham)
|
21
23
|
|
22
|
-
should("detect category mismatch") { Classifier.new({:categories => %w(bad good)}) }.raises(LoadingError)
|
24
|
+
should("detect category mismatch") { Classifier.new({:categories => %w(bad good)}, :db => DB_NUM) }.raises(LoadingError)
|
23
25
|
|
24
26
|
context "in training" do
|
25
27
|
|