[Groonga-commit] groonga/fluent-plugin-droonga at 3fcaf07 [master] Return false if parameter "name" doesn't exist in "table_create"

Back to archive index

Kosuke Asami null+****@clear*****
Thu Jul 11 13:39:21 JST 2013


Kosuke Asami	2013-07-11 13:39:21 +0900 (Thu, 11 Jul 2013)

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

  Message:
    Return false if parameter "name" doesn't exist in "table_create"

  Modified files:
    lib/droonga/plugin/groonga/table_create.rb
    test/plugin/groonga/test_table_create.rb

  Modified: lib/droonga/plugin/groonga/table_create.rb (+2 -0)
===================================================================
--- lib/droonga/plugin/groonga/table_create.rb    2013-07-11 13:32:40 +0900 (c545300)
+++ lib/droonga/plugin/groonga/table_create.rb    2013-07-11 13:39:21 +0900 (49fcc9a)
@@ -26,6 +26,8 @@ module Droonga
 
       def execute(request)
         name = request["name"]
+        return [false] unless name
+
         options = parse_request(request)
         Groonga::Schema.define(:context => @context) do |schema|
           schema.create_table(name, options)

  Modified: test/plugin/groonga/test_table_create.rb (+5 -0)
===================================================================
--- test/plugin/groonga/test_table_create.rb    2013-07-11 13:32:40 +0900 (eee4b58)
+++ test/plugin/groonga/test_table_create.rb    2013-07-11 13:39:21 +0900 (980ad94)
@@ -19,6 +19,11 @@ class TableCreateTest < GroongaHandlerTest
     assert_equal([true], @worker.body)
   end
 
+  def test_failure
+    @handler.table_create({})
+    assert_equal([false], @worker.body)
+  end
+
   def test_name
     @handler.table_create({"name" => "Books"})
     assert_equal(<<-SCHEMA, dump)
-------------- next part --------------
HTML����������������������������...
Download 



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