[Groonga-commit] ranguba/rroonga at fc9b6c5 [master] test: define schema in setup

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Dec 30 15:54:25 JST 2014


Kouhei Sutou	2014-12-30 15:54:25 +0900 (Tue, 30 Dec 2014)

  New Revision: fc9b6c5930588677582880fd6730ac7aec90f650
  https://github.com/ranguba/rroonga/commit/fc9b6c5930588677582880fd6730ac7aec90f650

  Message:
    test: define schema in setup
    
    Because it's not important in the test.

  Modified files:
    test/test-column.rb

  Modified: test/test-column.rb (+21 -6)
===================================================================
--- test/test-column.rb    2014-12-30 15:51:41 +0900 (c997550)
+++ test/test-column.rb    2014-12-30 15:54:25 +0900 (c54d5cb)
@@ -520,20 +520,35 @@ class ColumnTest < Test::Unit::TestCase
   end
 
   class TruncateTest < self
-    def test_truncate
-      posts = Groonga::Hash.create(:name => "Posts", :key_type => "ShortText")
-      posts.define_column("body", "Text")
+    def setup
+      setup_database
+
+      setup_schema
+    end
+
+    def setup_schema
+      Groonga::Schema.define do |schema|
+        schema.create_table("Posts",
+                            :type => :hash,
+                            :key_type => "ShortText") do |table|
+          table.text("body")
+        end
+      end
 
+      @posts = Groonga["Posts"]
+    end
+
+    def test_truncate
       body1 = "body1"
       body2 = "body2"
       records = [
-        posts.add("title1", :body => body1),
-        posts.add("title2", :body => body2),
+        @posts.add("title1", :body => body1),
+        @posts.add("title2", :body => body2),
       ]
 
       assert_equal([body1, body2],
                    records.collect(&:body))
-      posts.column("body").truncate
+      @posts.column("body").truncate
       assert_equal([nil, nil],
                    records.collect(&:body))
     end
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index