Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/cc/services/github_pull_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions test/github_pull_requests_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}, ""] }

Expand Down