Skip to content

Commit

Permalink
Update git tests to use Mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
mjram0s committed Jun 17, 2021
1 parent 2b2482a commit 68fcf72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/git.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function posthook(p::Git, ::Template, pkg_dir::AbstractString)
LibGit2.with(GitRepo(pkg_dir)) do repo
LibGit2.add!(repo, ".")
msg = "Files generated by PkgTemplates"
v = version_of("PkgTemplates")
v = @mock version_of("PkgTemplates")
v === nothing || (msg *= "\n\nPkgTemplates version: $v")
# TODO: Put the template config in the message too?
commit(p, repo, pkg_dir, msg)
Expand Down
4 changes: 3 additions & 1 deletion test/git.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
@testset "Adds version to commit message" begin
# We're careful to avoid a Pkg.update as it triggers Cassette#130.
t = tpl(; plugins=[Git(), !Tests])
mock(PT.version_of => _p -> v"1.2.3") do _i

patch = @patch PkgTemplates.version_of(t) = v"1.2.3"
apply(patch) do
with_pkg(t) do pkg
pkg_dir = joinpath(t.dir, pkg)
LibGit2.with(GitRepo(pkg_dir)) do repo
Expand Down

0 comments on commit 68fcf72

Please sign in to comment.