Skip to content

Commit

Permalink
Replace with_mock() -> with_mocked_bindings()
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Dec 13, 2024
1 parent 38e1635 commit 8eadd93
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ test_that("it returns the package if given the root or child directory", {
})

test_that("it works as expected", {
with_mock(`covr:::system_output` = function(...) { "test_branch " }, {
with_mocked_bindings(
system_output = function(...) {"test_branch "},
expect_equal(local_branch("TestSummary"), "test_branch")
})
)
})

test_that("it works as expected", {
with_mock(`covr:::system_output` = function(...) { " test_hash" }, {
expect_equal(current_commit("TestSummary"), "test_hash")
})
with_mocked_bindings(
system_output = function(...) {" test_hash"},
expect_equal(current_commit("TestSummary"), "test_hash")
)
})

test_that("it works", {
Expand Down

0 comments on commit 8eadd93

Please sign in to comment.