Skip to content

Commit

Permalink
changed loading of tests to pick up frozen rails. Useful to test agai…
Browse files Browse the repository at this point in the history
…nst 2.2 and 2.3
  • Loading branch information
graysky committed Apr 17, 2009
1 parent 37acb0d commit 58deec8
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Load Rails from the app, which allows picking up a frozen rails install
# instead of from the gems
#
# Borrowed from setup in classic_pagination plugin
plugin_root = File.join(File.dirname(__FILE__), '..')
# is the plugin installed in an application?
app_root = plugin_root + '/../../..'

if File.directory? app_root + '/config'
ENV['RAILS_ENV'] = 'test'
require File.expand_path(app_root + '/config/boot')
end

require 'pp'
require 'test/unit'
require 'rubygems'
require 'active_support'
Expand All @@ -9,24 +23,11 @@
require 'active_record'
require 'active_record/fixtures'

require 'pp'

# Load the Translator init after loading Rails
require File.dirname(__FILE__) + '/../init'
RAILS_ENV = "test" unless defined? RAILS_ENV

# Set up an ActiveRecord connection to sqlite db for testing
#
# Borrowed from setup in classic_pagination plugin

plugin_root = File.join(File.dirname(__FILE__), '..')
# is the plugin installed in an application?
app_root = plugin_root + '/../../..'

if File.directory? app_root + '/config'
ENV['RAILS_ENV'] = 'test'
require File.expand_path(app_root + '/config/boot')
end

# Define the connector
class ActiveRecordTestConnector
cattr_accessor :able_to_connect
Expand Down Expand Up @@ -82,4 +83,4 @@ def load_schema
end
end

ActiveRecordTestConnector.setup
ActiveRecordTestConnector.setup

0 comments on commit 58deec8

Please sign in to comment.