[Groonga-commit] groonga/fluent-plugin-droonga at ac95022 [master] test adapter_select: extract common request hashes and an assert as a method

Back to archive index

Kosuke Asami null+****@clear*****
Tue Jul 23 15:28:08 JST 2013


Kosuke Asami	2013-07-23 15:28:08 +0900 (Tue, 23 Jul 2013)

  New Revision: ac95022a4a2230f7ee0344314c050b98438818f5
  https://github.com/groonga/fluent-plugin-droonga/commit/ac95022a4a2230f7ee0344314c050b98438818f5

  Message:
    test adapter_select: extract common request hashes and an assert as a method

  Modified files:
    test/plugin/adapter/groonga/test_select.rb

  Modified: test/plugin/adapter/groonga/test_select.rb (+8 -28)
===================================================================
--- test/plugin/adapter/groonga/test_select.rb    2013-07-23 15:22:34 +0900 (327b677)
+++ test/plugin/adapter/groonga/test_select.rb    2013-07-23 15:28:08 +0900 (5ddc799)
@@ -54,10 +54,10 @@ class AdapterGroongaSelectTest < Test::Unit::TestCase
     end
 
     class OutputColumnsTest < self
-      def test_multiple_columns
+      def assert_attributes(expected_attributes, output_columns)
         select_request = {
           "table" => "EmptyTable",
-          "output_columns" => "_id,_key",
+          "output_columns" => output_columns,
         }
 
         expected_search_request = {
@@ -72,41 +72,21 @@ class AdapterGroongaSelectTest < Test::Unit::TestCase
                   "attributes",
                   "records",
                 ],
-                "attributes" => ["_id", "_key"],
+                "attributes" => expected_attributes,
               },
             },
           },
         }
-
         assert_equal(expected_search_request, convert(select_request))
       end
 
+      def test_multiple_columns
+        assert_attributes(["_id", "_key"], "_id,_key")
+      end
+
       class FunctionTest < self
         def test_single_argument
-          select_request = {
-            "table" => "EmptyTable",
-            "output_columns" => "snippet_html(content)",
-          }
-
-          expected_search_request = {
-            "queries" => {
-              "EmptyTable" => {
-                "source"   => "EmptyTable",
-                "output"   => {
-                  "elements"   => [
-                    "startTime",
-                    "elapsedTime",
-                    "count",
-                    "attributes",
-                    "records",
-                  ],
-                  "attributes" => ["snippet_html(content)"],
-                },
-              },
-            },
-          }
-
-          assert_equal(expected_search_request, convert(select_request))
+          assert_attributes(["snippet_html(content)"], "snippet_html(content)")
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
Download 



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