1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/spec/spec_helper.rb

36 lines
835 B
Ruby
Raw Normal View History

dir = File.dirname(__FILE__)
$LOAD_PATH.unshift "#{dir}/../lib"
2007-12-30 14:35:44 -05:00
require 'rubygems'
require 'spec'
require 'pp'
2008-04-13 22:20:05 -04:00
require 'fileutils'
require 'arel'
2008-01-04 02:41:43 -05: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
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|
config.include BeLikeMatcher, HashTheSameAsMatcher, DisambiguateAttributesMatcher
config.include AdapterGuards
config.mock_with :rr
config.before do
Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base)
end
2009-04-23 10:02:39 -04:00
end