Skip to content

Commit

Permalink
Fix tests for new git2r
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Mar 13, 2018
1 parent 21fe55a commit 8944e11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions tests/testthat/test-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ git_test_repo <- function() {
}

test_that("SHA for regular repository", {
skip_on_cran()

r <- git_test_repo()
commit <- git2r::commits(r)[[1]]
expect_false(git2r::is_commit(utils::head(r)))
expect_false(git2r::is_commit(git2r::repository_head(r)))
expect_equal(git_repo_sha1(r), as.data.frame(commit)$sha)
})

Expand All @@ -24,6 +26,6 @@ test_that("SHA for detached head", {
r <- git_test_repo()
commit <- git2r::commits(r)[[1]]
git2r::checkout(commit)
expect_true(git2r::is_commit(utils::head(r)))
expect_true(git2r::is_commit(git2r::repository_head(r)))
expect_equal(git_repo_sha1(r), as.data.frame(commit)$sha)
})
4 changes: 2 additions & 2 deletions tests/testthat/test-remote-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_that("install on packages adds metadata", {
library("testMetadataInstall")
pkg_info <- session_info()$packages
pkg_source <- pkg_info[pkg_info[, "package"] %in% "testMetadataInstall", "source"]
pkg_sha <- substring(git2r::commits(r)[[1]]@sha, 1, 7)
pkg_sha <- substring(git2r::commits(r)[[1]]$sha, 1, 7)
expect_match(pkg_source, pkg_sha)

# dirty the repo
Expand All @@ -56,7 +56,7 @@ test_that("install on packages adds metadata", {
install(test_pkg, quiet = TRUE)
pkg_info <- session_info()$packages
pkg_source <- pkg_info[pkg_info[, "package"] %in% "testMetadataInstall", "source"]
pkg_sha <- substring(git2r::commits(r)[[1]]@sha, 1, 7)
pkg_sha <- substring(git2r::commits(r)[[1]]$sha, 1, 7)
expect_match(pkg_source, pkg_sha)

})
Expand Down

0 comments on commit 8944e11

Please sign in to comment.