test/subversion: fix subversion paths/detection.

This commit is contained in:
Mike McQuaid 2019-11-06 14:58:33 +00:00
parent 924af100b7
commit 6a33959888
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 14 additions and 5 deletions

View File

@ -124,8 +124,19 @@ RSpec.configure do |config|
end
config.before(:each, :needs_svn) do
homebrew_bin = File.dirname HOMEBREW_BREW_FILE
skip "subversion not installed." unless %W[/usr/bin/svn #{homebrew_bin}/svn].map { |x| File.executable?(x) }.any?
svn_paths = PATH.new(ENV["PATH"])
if OS.mac?
xcrun_svn = Utils.popen_read("xcrun", "-f", "svn")
svn_paths.append(File.dirname(xcrun_svn)) if $CHILD_STATUS.success? && xcrun_svn.present?
end
svn = which("svn", svn_paths)
svnadmin = which("svnadmin", svn_paths)
skip "subversion not installed." if !svn || !svnadmin
ENV["PATH"] = PATH.new(ENV["PATH"])
.append(svn.dirname)
.append(svnadmin.dirname)
end
config.before(:each, :needs_unzip) do

View File

@ -8,9 +8,7 @@ describe UnpackStrategy::Subversion, :needs_svn do
let(:path) { working_copy }
before do
svnadmin = ["svnadmin"]
svnadmin = ["xcrun", *svnadmin] if OS.mac? && MacOS.version >= :catalina
safe_system(*svnadmin, "create", repo)
safe_system "svnadmin", "create", repo
safe_system "svn", "checkout", "file://#{repo}", working_copy
FileUtils.touch working_copy/"test"