Skip to content

Instantly share code, notes, and snippets.

@trevrosen
Created June 25, 2009 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevrosen/136021 to your computer and use it in GitHub Desktop.
Save trevrosen/136021 to your computer and use it in GitHub Desktop.
$: << 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