Sha256: 4ca147d0e599f5143425ddac1b87cb3a87cc7fc9de312de3ee3a57f9e7d90d6c
Contents?: true
Size: 694 Bytes
Versions: 4
Compression:
Stored size: 694 Bytes
Contents
require 'fileutils' # Return path to temparory directory for testing. def testdir return @testdir ||= File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tmp', 'spec')) end # Create a temporary testing directory, change into it, and execute the # +block+. When the block exists, remove the test directory and change back # to the previous directory. def mktestdircd(&block) previousdir = Dir.pwd rmtestdir FileUtils.mkdir_p(testdir) Dir.chdir(testdir) block.call ensure rmtestdir Dir.chdir previousdir end # Remove the temporary test directory. def rmtestdir FileUtils.rm_rf(testdir) if File.directory?(testdir) end
Version data entries
4 entries across 4 versions & 1 rubygems