Sha256: a975b31b0ff8ee68c2a9ec041742547a588b30f9256221e9de2ed51a83395445
Contents?: true
Size: 555 Bytes
Versions: 11
Compression:
Stored size: 555 Bytes
Contents
require_relative "capture_stdout" # Path to the `tmp/sandbox`. def sandbox @sandbox ||= File.expand_path "../../../../../tmp/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
11 entries across 11 versions & 1 rubygems