Created
June 25, 2009 17:56
-
-
Save trevrosen/136021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$: << File.join(File.dirname(__FILE__), '..') | |
begin | |
require "spec" | |
require "spec/interop/test" | |
require 'rack/test' | |
require "proxy" | |
require "libxml" | |
Test::Unit::TestCase.send :include, Rack::Test | |
rescue LoadError => error | |
puts | |
puts "You're missing some gems required to load the tests" | |
puts | |
puts error | |
puts | |
exit 1 | |
end | |
# Set up test env | |
set :environment, :test | |
set :run, false | |
set :raise_errors, true | |
set :logging, false | |
#--------------from config.rb -------------------- | |
# DB STUFF ----------------------------------------------- | |
db = File.open File.dirname(__FILE__) + "/database.yml" | |
ActiveRecord::Base.configurations = YAML.load(db) | |
def main_app_db | |
config = ActiveRecord::Base.configurations | |
case | |
when development? | |
ZPROXY_CONFIG['env'] = "development" | |
when test? | |
ZPROXY_CONFIG['env'] = "test" | |
when production? | |
ZPROXY_CONFIG['env'] = "production" | |
else | |
ZPROXY_CONFIG['env'] = "development" | |
end | |
config[ZPROXY_CONFIG['env']].symbolize_keys | |
end | |
ActiveRecord::Base.establish_connection(main_app_db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment