From 27338212e6347bebed1cbf08963a9af110368b76 Mon Sep 17 00:00:00 2001 From: Kevin Thompson Date: Sun, 16 Dec 2012 23:47:00 -0800 Subject: Establish test suite. --- test/test_helper.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/test_helper.rb (limited to 'test/test_helper.rb') diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..d2337c5 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,34 @@ +require 'rack/test' +require 'stringio' +require 'test/unit' +require 'tmpdir' + +ENV['RACK_ENV'] = 'test' +WORKING_DIRECTORY = Dir.pwd.freeze +ARGV.clear + +def silent + _stdout = $stdout + $stdout = mock = StringIO.new + begin + yield + ensure + $stdout = _stdout + end +end + +def temp + path = File.expand_path "#{Dir.tmpdir}/#{Time.now.to_i}#{rand(1000)}/" + FileUtils.mkdir_p path + Dir.chdir path + yield path +ensure + Dir.chdir WORKING_DIRECTORY + FileUtils.rm_rf(path) if File.exists?(path) +end + +module Dashing + class Test < Test::Unit::TestCase + include Rack::Test::Methods + end +end \ No newline at end of file -- cgit v1.2.3