[Groonga-commit] groonga/groonga-query-log at dc56d68 [master] test replayer: extract not test target code

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jul 5 18:34:10 JST 2013


Kouhei Sutou	2013-07-05 18:34:10 +0900 (Fri, 05 Jul 2013)

  New Revision: dc56d68d6fce1dc2e041f2dd881c0781b074ceaf
  https://github.com/groonga/groonga-query-log/commit/dc56d68d6fce1dc2e041f2dd881c0781b074ceaf

  Message:
    test replayer: extract not test target code

  Modified files:
    test/test-replayer.rb

  Modified: test/test-replayer.rb (+14 -9)
===================================================================
--- test/test-replayer.rb    2013-07-05 18:31:59 +0900 (20cec0a)
+++ test/test-replayer.rb    2013-07-05 18:34:10 +0900 (8727a73)
@@ -26,15 +26,7 @@ class ReplayerTest < Test::Unit::TestCase
     def test_host
       host = "example.com"
       @options.host = host
-      expected_open_options = {
-        :host     => host,
-        :port     => 10041,
-        :protocol => :gqtp,
-      }
-      client = Object.new
-      mock(Groonga::Client).open(expected_open_options).yields(client) do
-        client
-      end
+      mock_client_open(:host => host)
       replay
     end
 
@@ -43,5 +35,18 @@ class ReplayerTest < Test::Unit::TestCase
       replayer = Groonga::QueryLog::Replayer.new(@options)
       replayer.replay(StringIO.new(""))
     end
+
+    def mock_client_open(expected_options)
+      client = Object.new
+      default_options = {
+        :host     => "127.0.0.1",
+        :port     => 10041,
+        :protocol => :gqtp,
+      }
+      expected_open_options = default_options.merge(expected_options)
+      mock(Groonga::Client).open(expected_open_options).yields(client) do
+        client
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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