Sha256: e063fdd7f9719ef08b12578ac4c9628c4eaa5098cb43273a0039ac5c5b9034d3
Contents?: true
Size: 579 Bytes
Versions: 19
Compression:
Stored size: 579 Bytes
Contents
# encoding: utf-8 require 'tmpdir' require 'fileutils' shared_context 'isolated environment', :isolated_environment do around do |example| Dir.mktmpdir do |tmpdir| original_home = ENV['HOME'] begin virtual_home = File.expand_path(File.join(tmpdir, 'home')) Dir.mkdir(virtual_home) ENV['HOME'] = virtual_home working_dir = File.join(tmpdir, 'work') Dir.mkdir(working_dir) Dir.chdir(working_dir) do example.run end ensure ENV['HOME'] = original_home end end end end
Version data entries
19 entries across 19 versions & 2 rubygems