[Groonga-commit] droonga/fluent-plugin-droonga at 31e3033 [master] Test: handle results of table_create command with mocked "emit"

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 20 14:02:35 JST 2013


YUKI Hiroshi	2013-11-20 14:02:35 +0900 (Wed, 20 Nov 2013)

  New Revision: 31e3033ce1770bb1791df6ce4203282c7d66ca91
  https://github.com/droonga/fluent-plugin-droonga/commit/31e3033ce1770bb1791df6ce4203282c7d66ca91

  Message:
    Test: handle results of table_create command with mocked "emit"

  Modified files:
    test/plugin/handler/groonga/test_table_create.rb

  Modified: test/plugin/handler/groonga/test_table_create.rb (+8 -0)
===================================================================
--- test/plugin/handler/groonga/test_table_create.rb    2013-11-20 13:38:01 +0900 (cc55781)
+++ test/plugin/handler/groonga/test_table_create.rb    2013-11-20 14:02:35 +0900 (fa5797a)
@@ -15,6 +15,7 @@
 
 class TableCreateTest < GroongaHandlerTest
   def test_success
+    mock(@handler).emit([true])
     @handler.table_create({"name" => "Books"})
     assert_equal(
       [[Droonga::GroongaHandler::Status::SUCCESS, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], true],
@@ -23,6 +24,7 @@ class TableCreateTest < GroongaHandlerTest
   end
 
   def test_failure
+    mock(@handler).emit([false])
     @handler.table_create({})
     assert_equal(
       [[Droonga::GroongaHandler::Status::INVALID_ARGUMENT, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], false],
@@ -31,6 +33,7 @@ class TableCreateTest < GroongaHandlerTest
   end
 
   def test_name
+    mock(@handler).emit([true])
     @handler.table_create({"name" => "Books"})
     assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
@@ -81,6 +84,7 @@ table_create Books TABLE_NO_KEY
         "name" => "Books",
         "flags" => data[:flags],
       }
+      mock(@handler).emit([true])
       @handler.table_create(request)
       assert_equal(data[:schema], dump)
     end
@@ -92,6 +96,7 @@ table_create Books TABLE_NO_KEY
         "name"  => "Books",
         "key_type" => "Int32",
       }
+      mock(@handler).emit([true])
       @handler.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type Int32
@@ -105,6 +110,7 @@ table_create Books TABLE_HASH_KEY --key_type Int32
         "name"  => "Books",
         "value_type" => "Int32",
       }
+      mock(@handler).emit([true])
       @handler.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText --value_type Int32
@@ -118,6 +124,7 @@ table_create Books TABLE_HASH_KEY --key_type ShortText --value_type Int32
         "name"  => "Books",
         "default_tokenizer" => "TokenBigram",
       }
+      mock(@handler).emit([true])
       @handler.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText --default_tokenizer TokenBigram
@@ -131,6 +138,7 @@ table_create Books TABLE_HASH_KEY --key_type ShortText --default_tokenizer Token
         "name"  => "Books",
         "normalizer" => "NormalizerAuto",
       }
+      mock(@handler).emit([true])
       @handler.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY|KEY_NORMALIZE --key_type ShortText
-------------- next part --------------
HTML����������������������������...
Download 



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