Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Apr 9, 2024
1 parent 5714501 commit c827e3a
Show file tree
Hide file tree
Showing 10 changed files with 725 additions and 1,733 deletions.
3 changes: 1 addition & 2 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ rhub_check <- function(gh_url = NULL, platforms = NULL, r_versions = NULL,
)

git_root <- if (is.null(gh_url)) setup_find_git_root()
pat_url <- gh_url %||% "https://github.com"
pat <- doctor_find_pat(pat_url)
gh_url <- gh_url %||% doctor_find_gh_url(repo = git_root)
pat <- doctor_find_pat(gh_url)

if (is.null(branch)) {
if (!is.null(git_root)) {
Expand Down
7 changes: 3 additions & 4 deletions R/doctor.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ rhub_doctor <- function(gh_url = NULL) {
git_root <- if (is.null(gh_url)) setup_find_git_root()
if (is.null(gh_url)) check_rpkg_root(rpkg_root, git_root)

pat_url <- gh_url %||% "https://github.com"
pat <- doctor_find_pat(pat_url)
gh_url <- gh_url %||% doctor_find_gh_url(repo = git_root)
pat <- doctor_find_pat(gh_url)

# -----------------------------------------------------------------------
# Do these up front, concurrently
Expand Down Expand Up @@ -134,7 +133,7 @@ doctor_check_github <- function(gh_url, resp) {
repository.",
i = "R-hub only supports GitHub packages in GitHub repositories
currently.",
i = "If you think that this is a bug in the {pkg rhub} package,
i = "If you think that this is a bug in the {.pkg rhub} package,
please let us know!"
))
}
Expand Down Expand Up @@ -170,7 +169,7 @@ doctor_check_pat_scopes <- function(resp) {
call. = FALSE,
"Your PAT does not have a {.code repo} scope.",
i = "Withoput a {.code repo} scope R-hub cannot start jobs on GitHub.",
i = "Change the scoped of the PAT on the GitHub web page, or create
i = "Change the scopes of the PAT on the GitHub web page, or create
a new PAT."
))
}
Expand Down
27 changes: 27 additions & 0 deletions tests/testthat/_snaps/check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# rhub_check

Code
rhub_check("https://github.com/r-lib/ps", platforms = c("linux", "clang18"))
Message
v Check started: linux, clang18 (kleptomaniac-harlequinbug).
See <https://github.com/r-lib/ps/actions> for live output!

---

Code
rhub_check("https://github.com/r-lib/ps", platforms = c("linux", "clang18"))
Condition
Error:
! :( Failed to start check: I am so, so sorry!.
i If you think this is a bug in the rhub package, please open an issues at <https://github.com/r-hub/rhub/issues>.

---

Code
rhub_check(platforms = c("linux", "clang18"))
Message
v Check started: linux, clang18 (kleptomaniac-harlequinbug).
See <https://github.com/r-lib/ps/actions> for live output!

Loading

0 comments on commit c827e3a

Please sign in to comment.