aboutsummaryrefslogblamecommitdiffstats
path: root/spec/spec_helper.rb
blob: 4ea307151501748c1bfd09ead72cd860f013195d (plain) (tree)
1
2
3
4
5
6
7
8
9

                  
                   
              
 
                                  
                       
                                                                                
 



                                                        
                                  
                         
                      
 

                                                 
 









                                                                    
   
require 'rubygems'
require 'spec'
require 'fileutils'
require 'arel'

require 'support/matchers/be_like'
require 'support/check'
Dir[File.join(File.dirname(__FILE__),'support/shared/*')].each { |f| require f }

if adapter = ENV['ADAPTER']
  require "support/connections/#{adapter}_connection.rb"
end

Spec::Runner.configure do |config|
  config.include Matchers
  config.include Check

  if defined?(ActiveRecord::Base)
    tmp = File.expand_path('../../tmp', __FILE__)

    FileUtils.mkdir_p(tmp)
    ActiveRecord::Base.logger = Logger.new("#{tmp}/debug.log")
    ActiveRecord::Base.establish_connection("unit")

    require "support/schemas/#{ENV['ADAPTER']}_schema.rb"

    config.before do
      Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base)
    end
  end
end