debian-mirror-gitlab/spec/support/tmpdir.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
371 B
Ruby
Raw Normal View History

2023-03-17 16:20:25 +05:30
# frozen_string_literal: true
2023-06-20 00:43:36 +05:30
require 'tmpdir'
2023-03-17 16:20:25 +05:30
module TmpdirHelper
def mktmpdir
@tmpdir_helper_dirs ||= []
@tmpdir_helper_dirs << Dir.mktmpdir
@tmpdir_helper_dirs.last
end
def self.included(base)
base.after do
if @tmpdir_helper_dirs
FileUtils.rm_rf(@tmpdir_helper_dirs)
@tmpdir_helper_dirs = nil
end
end
end
end