[Groonga-commit] droonga/fluent-plugin-droonga at 2b8e711 [master] test catalog: extract #option test

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 30 17:59:16 JST 2014


Kouhei Sutou	2014-01-30 17:59:16 +0900 (Thu, 30 Jan 2014)

  New Revision: 2b8e7116301fbef450c1361a823ac703a7c1d217
  https://github.com/droonga/fluent-plugin-droonga/commit/2b8e7116301fbef450c1361a823ac703a7c1d217

  Message:
    test catalog: extract #option test

  Modified files:
    test/unit/catalog/test_version1.rb

  Modified: test/unit/catalog/test_version1.rb (+26 -10)
===================================================================
--- test/unit/catalog/test_version1.rb    2014-01-30 17:53:03 +0900 (390029d)
+++ test/unit/catalog/test_version1.rb    2014-01-30 17:59:16 +0900 (092fda1)
@@ -16,15 +16,37 @@
 require "droonga/catalog/version1"
 
 class CatalogTest < Test::Unit::TestCase
+  def minimum_data
+    {
+      "datasets" => [],
+    }
+  end
+
+  class OptionTest < self
+    def setup
+    end
+
+    def create_catalog(options)
+      super(minimum_data.merge("options" => options), "base-path")
+    end
+
+    def test_nonexistent
+      catalog = create_catalog({})
+      assert_nil(catalog.option("nonexistent"))
+    end
+
+    def test_existent
+      catalog = create_catalog("plugins" => ["crud", "groonga"])
+      assert_equal(["crud", "groonga"],
+                   catalog.option("plugins"))
+    end
+  end
+
   def setup
     data = JSON.parse(File.read(catalog_path))
     @catalog = create_catalog(data, base_path)
   end
 
-  def test_option
-    assert_equal(["for_global"], @catalog.option("plugins"))
-  end
-
   def test_get_partitions
     partitions =****@catal*****_partitions("localhost:23003/test")
     assert_equal({
@@ -107,9 +129,6 @@ class CatalogTest < Test::Unit::TestCase
     end
 
     def options(data)
-      minimum_data = {
-        "datasets" => [],
-      }
       catalog = create_catalog(minimum_data.merge(data), "base-path")
       catalog.input_adapter_options
     end
@@ -160,9 +179,6 @@ class CatalogTest < Test::Unit::TestCase
     end
 
     def options(data)
-      minimum_data = {
-        "datasets" => [],
-      }
       catalog = create_catalog(minimum_data.merge(data), "base-path")
       catalog.output_adapter_options
     end
-------------- next part --------------
HTML����������������������������...
다운로드 



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