Commit 11696ab

mo khan <mo@mokhan.ca>
2021-07-11 03:06:41
test: accept web hook for new installation
1 parent edd17c3
Changed files (2)
config/application.rb
@@ -16,6 +16,6 @@ module Sparkles
   class Application < Rails::Application
     config.load_defaults 6.1
     config.generators.system_tests = nil
-    config.logger = Logger.new(STDOUT)
+    #config.logger = Logger.new(STDOUT)
   end
 end
test/controllers/githubs_controller_test.rb
@@ -0,0 +1,38 @@
+require "test_helper"
+
+class GithubsControllerTest < ActionDispatch::IntegrationTest
+  test "accepts a new app installation webhook" do
+    post '/github', params: {
+      "zen": "Design for failure.",
+      "hook_id": 306990071,
+      "hook": {
+        "type": "App",
+        "id": 306990071,
+        "name": "web",
+        "active": true,
+        "events": [
+          "commit_comment",
+          "create",
+          "delete",
+          "meta",
+          "pull_request",
+          "pull_request_review",
+          "pull_request_review_comment",
+          "workflow_dispatch",
+          "workflow_run"
+        ],
+        "config": {
+          "content_type": "json",
+          "insecure_ssl": "0",
+          "url": "https://f92dbf01bd27.ngrok.io/gh/hook/"
+        },
+        "updated_at": "2021-07-11T02:15:28Z",
+        "created_at": "2021-07-11T02:15:28Z",
+        "app_id": 125988,
+        "deliveries_url": "https://api.github.com/app/hook/deliveries"
+      }
+    }
+
+    assert_response :no_content
+  end
+end