[Groonga-commit] ranguba/groonga-client at e5aeda3 [master] test: use sub test case for not shared tests

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Feb 6 22:56:21 JST 2016


Kouhei Sutou	2016-02-06 22:56:21 +0900 (Sat, 06 Feb 2016)

  New Revision: e5aeda30bc2f0a67bfb77fe9816ab8c079a6acbe
  https://github.com/ranguba/groonga-client/commit/e5aeda30bc2f0a67bfb77fe9816ab8c079a6acbe

  Message:
    test: use sub test case for not shared tests

  Modified files:
    test/test-client.rb

  Modified: test/test-client.rb (+19 -18)
===================================================================
--- test/test-client.rb    2016-02-06 22:51:12 +0900 (8dd8410)
+++ test/test-client.rb    2016-02-06 22:56:21 +0900 (6f30da8)
@@ -255,19 +255,6 @@ JSON
     end
   end
 
-  module BasicAuthenticationTests
-    def setup
-      @user = 'Aladdin'
-      @password = 'open sesame'
-    end
-
-    def test_request_header
-      stub_response('[]')
-      client.status
-      assert_equal 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==', @request_headers['authorization']
-    end
-  end
-
   module Tests
     include Utils
     include Assertions
@@ -323,19 +310,15 @@ JSON
 
   class TestHTTP < self
     include Tests
-    include BasicAuthenticationTests
     include ClientFixture
 
     def setup
-      super
-
       @address = "127.0.0.1"
       @server = TCPServer.new(@address, 0)
       @port =****@serve*****[1]
       @protocol = :http
 
-      @user ||= nil
-      @password ||= nil
+      setup_authentication
       @request_headers = {}
       @actual_commands = []
       @response_body = nil
@@ -396,5 +379,23 @@ EOH
         client.close
       end
     end
+
+    def setup_authentication
+      @user = nil
+      @password = nil
+    end
+
+    class TestBasicAuthentication < self
+      def setup_authentication
+        @user = 'Aladdin'
+        @password = 'open sesame'
+      end
+
+      def test_request_header
+        stub_response('[]')
+        client.status
+        assert_equal 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==', @request_headers['authorization']
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
下載 



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