From f8e24227a008686e9563a5a7b89f3d001adb9533 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Tue, 20 May 2008 22:13:42 +0200 Subject: [PATCH] Create missing directories before testing. Create test/{db,log} before running the tests proper so SQLite and Logger can write their files. --- .gitignore | 2 ++ test/helper.rb | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5214bc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +test/db +test/log \ No newline at end of file diff --git a/test/helper.rb b/test/helper.rb index 7e7c74b..bd3d2e4 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -16,11 +16,16 @@ require 'sqlite3' require 'mocha' require 'bacon' +require 'fileutils' -ActiveRecord::Base.logger = Logger.new File.join(TEST_ROOT_DIR, '/log/test.log') -ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :dbfile => File.join(TEST_ROOT_DIR, '/db/test.db')) +logdir = File.join(TEST_ROOT_DIR, 'log') +FileUtils.mkdir_p(logdir) +ActiveRecord::Base.logger = Logger.new File.join(logdir, 'test.log') +dbdir = File.join(TEST_ROOT_DIR, 'db') +FileUtils.mkdir_p(dbdir) +ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :dbfile => File.join(dbdir, 'test.db')) # Classes and methods to aid testing require 'schema' require 'attachments' -require 'upload_helpers' \ No newline at end of file +require 'upload_helpers'