Sha256: 7101951c67dd42bf629976207e11b355173416ca1c186ae5ddc6b8be0569c1ef
Contents?: true
Size: 883 Bytes
Versions: 1
Compression:
Stored size: 883 Bytes
Contents
require 'fileutils' module TemporaryFiles TEMP_DIR = File.expand_path('tmp', File.join(File.dirname(__FILE__), '..')) def remove_temp_directory if File.exist?(TemporaryFiles::TEMP_DIR) FileUtils.rm_r(TemporaryFiles::TEMP_DIR) end end def temp_path(base) File.join(TemporaryFiles::TEMP_DIR, base) end def project_root temp_path('mysite.com') end def project_path(path) File.join(project_root, path) end def in_temporary_project(*args, &block) FileUtils.mkdir_p(File.join(project_root, 'config')) FileUtils.touch(File.join(project_root, 'Gemfile')) FileUtils.touch(File.join(project_root, 'config', 'config.yml')) Dir.chdir(project_root) { yield project_root } ensure remove_temp_directory end def assert_exists_in_project(path) assert File.exist?(project_path(path)), "#{path} should exist" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nesta-0.18.0 | test/support/temporary_files.rb |