[Groonga-commit] droonga/fluent-plugin-droonga at 4759c95 [master] test: use mock to test expected behavior

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Oct 9 11:52:31 JST 2013


Kouhei Sutou	2013-10-09 11:52:31 +0900 (Wed, 09 Oct 2013)

  New Revision: 4759c9581d3c3a088c6da60232508447d09cdfa6
  https://github.com/droonga/fluent-plugin-droonga/commit/4759c9581d3c3a088c6da60232508447d09cdfa6

  Message:
    test: use mock to test expected behavior

  Modified files:
    test/plugin/handler/test_handler_add.rb

  Modified: test/plugin/handler/test_handler_add.rb (+5 -1)
===================================================================
--- test/plugin/handler/test_handler_add.rb    2013-10-09 11:49:21 +0900 (4a7f9aa)
+++ test/plugin/handler/test_handler_add.rb    2013-10-09 11:52:31 +0900 (8f62e5b)
@@ -70,6 +70,7 @@ class AddHandlerTest < Test::Unit::TestCase
         "key"    => "mori",
         "values" => {},
       }
+      mock(@handler).emit([true])
       @handler.add(request)
       table =****@worke*****["Users"]
       assert_equal(["mori"], table.collect(&:key))
@@ -81,6 +82,7 @@ class AddHandlerTest < Test::Unit::TestCase
         "key"    => "asami",
         "values" => {"country" => "japan"},
       }
+      mock(@handler).emit([true])
       @handler.add(request)
       table =****@worke*****["Users"]
       assert_equal(["japan"], table.collect(&:country))
@@ -102,6 +104,7 @@ class AddHandlerTest < Test::Unit::TestCase
         "table"  => "Books",
         "values" => {},
       }
+      mock(@handler).emit([true])
       @handler.add(request)
       table =****@worke*****["Books"]
       assert_equal([nil], table.collect(&:title))
@@ -112,6 +115,7 @@ class AddHandlerTest < Test::Unit::TestCase
         "table"  => "Books",
         "values" => {"title" => "CSS"},
       }
+      mock(@handler).emit([true])
       @handler.add(request)
       table =****@worke*****["Books"]
       assert_equal(["CSS"], table.collect(&:title))
@@ -124,8 +128,8 @@ class AddHandlerTest < Test::Unit::TestCase
         "table"  => "Nonexistent",
         "values" => {},
       }
+      mock(@handler).emit([false])
       @handler.add(request)
-      assert_equal([false], @worker.body)
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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