[Groonga-commit] droonga/fluent-plugin-droonga at ff64c3c [master] Test: use more clear name

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 20 14:45:26 JST 2013


YUKI Hiroshi	2013-11-20 14:45:26 +0900 (Wed, 20 Nov 2013)

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

  Message:
    Test: use more clear name
    
    emitted =>
    messages

  Modified files:
    test/helper/handler_helper.rb
    test/plugin/handler/groonga/test_column_create.rb
    test/plugin/handler/groonga/test_table_create.rb
    test/plugin/handler/test_handler_search.rb

  Modified: test/helper/handler_helper.rb (+4 -8)
===================================================================
--- test/helper/handler_helper.rb    2013-11-20 14:31:05 +0900 (2651c95)
+++ test/helper/handler_helper.rb    2013-11-20 14:45:26 +0900 (f948f1b)
@@ -14,16 +14,12 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 module HandlerHelper
-  attr_reader :emitted
+  attr_reader :messages
 
   def setup_stub_emit(handler)
-    @emitted = []
-    stub(handler).emit do |response|
-      @emitted << response
+    @messages = []
+    stub(handler).emit do |message|
+      @messages << message
     end
   end
-
-  def last_emitted
-    @emitted.last
-  end
 end

  Modified: test/plugin/handler/groonga/test_column_create.rb (+1 -1)
===================================================================
--- test/plugin/handler/groonga/test_column_create.rb    2013-11-20 14:31:05 +0900 (240145d)
+++ test/plugin/handler/groonga/test_column_create.rb    2013-11-20 14:45:26 +0900 (b12140d)
@@ -17,7 +17,7 @@ class ColumnCreateTest < GroongaHandlerTest
   def test_success
     @handler.table_create({"name" => "Books"})
     @handler.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
-    assert_equal([true], last_emitted)
+    assert_equal([true], messages.last)
   end
 
   def test_name

  Modified: test/plugin/handler/groonga/test_table_create.rb (+4 -2)
===================================================================
--- test/plugin/handler/groonga/test_table_create.rb    2013-11-20 14:31:05 +0900 (7e64c7e)
+++ test/plugin/handler/groonga/test_table_create.rb    2013-11-20 14:45:26 +0900 (f94be8e)
@@ -16,17 +16,19 @@
 class TableCreateTest < GroongaHandlerTest
   def test_success
     @handler.table_create({"name" => "Books"})
+    response = messages.last
     assert_equal(
       [[Droonga::GroongaHandler::Status::SUCCESS, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], true],
-      [normalize_header(last_emitted.first), last_emitted.last]
+      [normalize_header(response.first), response.last]
     )
   end
 
   def test_failure
     @handler.table_create({})
+    response = messages.last
     assert_equal(
       [[Droonga::GroongaHandler::Status::INVALID_ARGUMENT, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], false],
-      [normalize_header(last_emitted.first), last_emitted.last]
+      [normalize_header(response.first), response.last]
     )
   end
 

  Modified: test/plugin/handler/test_handler_search.rb (+1 -1)
===================================================================
--- test/plugin/handler/test_handler_search.rb    2013-11-20 14:31:05 +0900 (5b989e7)
+++ test/plugin/handler/test_handler_search.rb    2013-11-20 14:45:26 +0900 (7db02e6)
@@ -44,7 +44,7 @@ class SearchHandlerTest < Test::Unit::TestCase
 
   def search(request)
     @handler.search(request)
-    normalize_result_set(last_emitted)
+    normalize_result_set(messages.last)
   end
 
   def normalize_result_set(result_set)
-------------- next part --------------
HTML����������������������������...
Download 



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