Change HOME
too when testing sync_default_gems.rb
As well as `GIT_CONFIG_GLOBAL`, which is supported since git 2.32.
This commit is contained in:
parent
4b91d6abb9
commit
628cc7e12d
@ -80,7 +80,8 @@ module Test_SyncDefaultGems
|
|||||||
@target = nil
|
@target = nil
|
||||||
pend "No git" unless system("git --version", out: IO::NULL)
|
pend "No git" unless system("git --version", out: IO::NULL)
|
||||||
@testdir = Dir.mktmpdir("sync")
|
@testdir = Dir.mktmpdir("sync")
|
||||||
@git_config = ENV["GIT_CONFIG_GLOBAL"]
|
@git_config = %W"HOME GIT_CONFIG_GLOBAL".each_with_object({}) {|k, c| c[k] = ENV[k]}
|
||||||
|
ENV["HOME"] = @testdir
|
||||||
ENV["GIT_CONFIG_GLOBAL"] = @testdir + "/gitconfig"
|
ENV["GIT_CONFIG_GLOBAL"] = @testdir + "/gitconfig"
|
||||||
system(*%W"git config --global user.email test@ruby-lang.org")
|
system(*%W"git config --global user.email test@ruby-lang.org")
|
||||||
system(*%W"git config --global user.name", "Ruby")
|
system(*%W"git config --global user.name", "Ruby")
|
||||||
@ -105,7 +106,7 @@ module Test_SyncDefaultGems
|
|||||||
if @target
|
if @target
|
||||||
Dir.chdir(@origdir)
|
Dir.chdir(@origdir)
|
||||||
SyncDefaultGems::REPOSITORIES.delete(@target.to_sym)
|
SyncDefaultGems::REPOSITORIES.delete(@target.to_sym)
|
||||||
ENV["GIT_CONFIG_GLOBAL"] = @git_config
|
ENV.update(@git_config)
|
||||||
FileUtils.rm_rf(@testdir)
|
FileUtils.rm_rf(@testdir)
|
||||||
end
|
end
|
||||||
super
|
super
|
||||||
|
Loading…
x
Reference in New Issue
Block a user