Sha256: 7705327d1214e79676ffb4c9c96ed584cd9195087171d14bad68dfa1b0d247f5
Contents?: true
Size: 548 Bytes
Versions: 4
Compression:
Stored size: 548 Bytes
Contents
require_relative "capture_stdout" # Path to the `tmp/sandbox`. def sandbox @sandbox ||= File.expand_path "../../../../sandbox", __FILE__ end # Clears `tmp/sandbox`. def clear_sandbox FileUtils.rm_rf sandbox end # Re-creates `spec/sandbox`. def prepare_sandbox clear_sandbox FileUtils.mkdir_p sandbox end # Runs code from `sandbox`. def try_in_sandbox FileUtils.cd(sandbox) { capture_stdout { yield } } end # Runs cli from `sandbox`. def run_in_sandbox(command) result = "" try_in_sandbox { result = `#{ command }` } result end
Version data entries
4 entries across 4 versions & 1 rubygems