[Groonga-commit] ranguba/chupa-text-http-server at dd07c76 [master] test: add URI API test

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jul 11 10:25:33 JST 2017


Kouhei Sutou	2017-07-11 10:25:33 +0900 (Tue, 11 Jul 2017)

  New Revision: dd07c76c499c626f445decea9a4d6a4fffcd0698
  https://github.com/ranguba/chupa-text-http-server/commit/dd07c76c499c626f445decea9a4d6a4fffcd0698

  Message:
    test: add URI API test

  Modified files:
    test/controllers/extractions_controller_test.rb

  Modified: test/controllers/extractions_controller_test.rb (+17 -0)
===================================================================
--- test/controllers/extractions_controller_test.rb    2017-07-11 09:52:24 +0900 (de61fb2)
+++ test/controllers/extractions_controller_test.rb    2017-07-11 10:25:33 +0900 (064d3c8)
@@ -160,6 +160,23 @@ class ExtractionsControllerTest < ActionDispatch::IntegrationTest
   end
 
   sub_test_case "API" do
+    sub_test_case "URI" do
+      test "success" do
+        run_http_server(content_type: "text/plain", body: "Hello") do |uri|
+          post(extraction_url(format: "json"),
+               params: {
+                 uri: uri,
+               })
+          assert_equal("application/json", response.content_type,
+                       response.body)
+          extracted = JSON.parse(response.body)["texts"].collect do |text|
+            text["body"]
+          end
+          assert_equal(["Hello"], extracted)
+        end
+      end
+    end
+
     sub_test_case "data" do
       def assert_extract(expected, fixture_name)
         post(extraction_url(format: "json"),
-------------- next part --------------
HTML����������������������������...
下載 



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