diff --git a/lib/cc/services/github_pull_requests.rb b/lib/cc/services/github_pull_requests.rb index 0683d87..22d554f 100644 --- a/lib/cc/services/github_pull_requests.rb +++ b/lib/cc/services/github_pull_requests.rb @@ -63,6 +63,12 @@ def receive_pull_request when "success" add_comment update_status("success", "Code Climate has analyzed this pull request.") + when "error" + update_status( + "error", + "Code Climate encountered an error while attempting to analyze this " + + "pull request." + ) end end diff --git a/test/github_pull_requests_test.rb b/test/github_pull_requests_test.rb index 638c487..ea4a6f5 100644 --- a/test/github_pull_requests_test.rb +++ b/test/github_pull_requests_test.rb @@ -27,6 +27,20 @@ def test_pull_request_status_success }) end + def test_pull_request_status_error + expect_status_update("pbrisbin/foo", "abc123", { + "state" => "error", + "description" => /encountered an error/, + }) + + receive_pull_request({ update_status: true }, { + github_slug: "pbrisbin/foo", + commit_sha: "abc123", + state: "error", + }) + + end + def test_pull_request_status_test_success @stubs.post("/repos/pbrisbin/foo/statuses/#{"0" * 40}") { |env| [422, {}, ""] }