[groonga-commit:2855] ranguba/ranguba [scoring] test for Entry#table, Entry#add (class methods)

null+ranguba at clear-code.com null+ranguba at clear-code.com
Tue Dec 21 14:36:52 EST 2010


SHIMODA Hiroshi	2010-11-05 08:25:28 +0000 (Fri, 05 Nov 2010)

  New Revision: 58ea17aeefc6a2c79155d4f77d6e73a23d1ecc88

  Log:
    test for Entry#table, Entry#add (class methods)

  Modified files:
    test/unit/entry_test.rb

  Modified: test/unit/entry_test.rb (+20 -0)
===================================================================
--- test/unit/entry_test.rb    2010-11-05 08:21:29 +0000 (f56ffc2)
+++ test/unit/entry_test.rb    2010-11-05 08:25:28 +0000 (9e4bd39)
@@ -62,6 +62,10 @@ class EntryTest < ActiveSupport::TestCase
                  entry.summary(options)
   end
 
+  def test_class_table
+    assert_equal Groonga::Hash, Entry.table.class
+  end
+
   def test_class_search
     result = Entry.search(:query => "HTML")
 
@@ -92,6 +96,22 @@ class EntryTest < ActiveSupport::TestCase
                           :to_s => "query/HTML/type/html"
   end
 
+  def test_class_add
+    result = Entry.search(:query => "HTML")
+    assert_equal 1, result[:entries].size
+    Entry.add("http://www.example.com/another-html",
+              :title => "Another HTML",
+              :type => "html",
+              :charset => "UTF-8",
+              :category => "test",
+              :author => "html author",
+              :mtime => Time.now,
+              :update => Time.now,
+              :body => "This is the contents of another HTML entry.")
+    result = Entry.search(:query => "HTML")
+    assert_equal 2, result[:entries].size
+  end
+
   private
   def get_first_entry(options={})
     entry = get_entries(options)[0]



More information about the groonga-commit mailing list