2008-04-15 02:38:50 -04:00
|
|
|
dir = File.dirname(__FILE__)
|
|
|
|
$LOAD_PATH.unshift "#{dir}/../lib"
|
|
|
|
|
2007-12-30 14:35:44 -05:00
|
|
|
require 'rubygems'
|
|
|
|
require 'spec'
|
2008-01-21 21:22:55 -05:00
|
|
|
require 'pp'
|
2008-04-13 22:20:05 -04:00
|
|
|
require 'fileutils'
|
2008-04-18 15:59:29 -04:00
|
|
|
require 'arel'
|
2008-01-04 02:41:43 -05:00
|
|
|
|
2008-04-15 02:38:50 -04:00
|
|
|
[:matchers, :doubles].each do |helper|
|
|
|
|
Dir["#{dir}/#{helper}/*"].each { |m| require "#{dir}/#{helper}/#{File.basename(m)}" }
|
2008-01-05 18:24:46 -05:00
|
|
|
end
|
|
|
|
|
2009-05-16 21:13:32 -04:00
|
|
|
module AdapterGuards
|
|
|
|
def adapter_is(name)
|
|
|
|
yield if name.to_s == adapter_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def adapter_is_not(name)
|
|
|
|
yield if name.to_s != adapter_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def adapter_name
|
|
|
|
Arel::Table.engine.connection.class.name.underscore.split("/").last.gsub(/_adapter/, '')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-04-23 10:02:39 -04:00
|
|
|
Spec::Runner.configure do |config|
|
2009-05-16 21:13:32 -04:00
|
|
|
config.include BeLikeMatcher, HashTheSameAsMatcher, DisambiguateAttributesMatcher
|
|
|
|
config.include AdapterGuards
|
2008-01-06 03:32:17 -05:00
|
|
|
config.mock_with :rr
|
2008-03-02 20:56:18 -05:00
|
|
|
config.before do
|
2009-05-17 14:20:29 -04:00
|
|
|
Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base)
|
2008-03-02 20:56:18 -05:00
|
|
|
end
|
2009-04-23 10:02:39 -04:00
|
|
|
end
|