[Groonga-commit] droonga/fluent-plugin-droonga at 8cedbd1 [master] Follow handler API change

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 19 17:39:36 JST 2013


Kouhei Sutou	2013-12-19 17:39:36 +0900 (Thu, 19 Dec 2013)

  New Revision: 8cedbd1b6ec72603ab9f21dd3c39f2e255a9baa2
  https://github.com/droonga/fluent-plugin-droonga/commit/8cedbd1b6ec72603ab9f21dd3c39f2e255a9baa2

  Message:
    Follow handler API change

  Modified files:
    test/unit/plugin/handler/test_search.rb

  Modified: test/unit/plugin/handler/test_search.rb (+17 -14)
===================================================================
--- test/unit/plugin/handler/test_search.rb    2013-12-19 17:30:28 +0900 (418c0dc)
+++ test/unit/plugin/handler/test_search.rb    2013-12-19 17:39:36 +0900 (8141091)
@@ -16,10 +16,10 @@
 require "droonga/plugin/handler/search"
 
 class SearchHandlerTest < Test::Unit::TestCase
-  include PluginHelper
-
   def setup
     setup_database
+    setup_data
+    setup_plugin
   end
 
   def teardown
@@ -27,16 +27,25 @@ class SearchHandlerTest < Test::Unit::TestCase
     teardown_database
   end
 
+  def setup_plugin
+    @handler = Droonga::Test::StubHandler.new
+    @plugin = Droonga::SearchHandler.new(@handler)
+  end
+
+  def teardown_plugin
+    @handler = nil
+    @plugin = nil
+  end
+
   private
   def search(request)
     @plugin.search(request)
-    results_to_result_set(@messages)
+    results_to_result_set(@handler.messages.first)
   end
 
   def results_to_result_set(results)
     result_set = {}
-    results.each do |result_and_name|
-      result, name = result_and_name
+    results.each do |name, result|
       result_set[name] = normalize_result(result)
     end
     result_set
@@ -61,10 +70,8 @@ class SearchHandlerTest < Test::Unit::TestCase
   end
 
   class GeneralTest < self
-    def setup
-      super
+    def setup_data
       restore(fixture_data("document.grn"))
-      setup_plugin(Droonga::SearchHandler)
     end
 
     class NoParameterTest < self
@@ -509,10 +516,8 @@ class SearchHandlerTest < Test::Unit::TestCase
 
   class ReferenceTest < self
     class Hash
-      def setup
-        super
+      def setup_data
         restore(fixture_data("reference/hash.grn"))
-        setup_plugin(Droonga::SearchHandler)
       end
 
       def test_reference_to_hash
@@ -554,10 +559,8 @@ class SearchHandlerTest < Test::Unit::TestCase
     end
 
     class Array
-      def setup
-        super
+      def setup_data
         restore(fixture_data("reference/array.grn"))
-        setup_plugin(Droonga::SearchHandler)
       end
 
       def test_reference_to_array
-------------- next part --------------
HTML����������������������������...
Download 



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