Sha256: 2191ccc30e5f8ba953cc57d0f426a380fac8d3e5c279686fdd00f80c0723876d

Contents?: true

Size: 519 Bytes

Versions: 4

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'
require 'fileutils'

UNIQUE_FILES_DIR = "./test/unique_files"

def require_unique_file(file = 'dog.rb')
  dir = "#{UNIQUE_FILES_DIR}/#{SecureRandom.uuid}"
  FileUtils.mkdir_p(dir)
  temp_file = "#{dir}/#{file}"
  File.open(temp_file, 'w'){ |w| w.write(File.read("./test/#{file}")) }
  require temp_file
  temp_file
end

def remove_unique_files
  FileUtils.rm_r(UNIQUE_FILES_DIR) if File.exist?(UNIQUE_FILES_DIR)
end

Minitest.after_run do
  remove_unique_files
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coverband-4.2.0 test/unique_files.rb
coverband-4.2.0.rc3 test/unique_files.rb
coverband-4.2.0.rc2 test/unique_files.rb
coverband-4.1.1 test/unique_files.rb