require 'rspec' begin require 'active_record' rescue LoadError end begin require 'mongoid' rescue LoadError end module Rails class < true config.run_all_when_everything_filtered = true end if active_record? ActiveRecord::Migration.verbose = false # Autoload every active_record model for the test suite that sits in spec/models. Dir[ File.join(MODELS, "*.rb") ].sort.each do |filename| name = File.basename(filename, ".rb") autoload name.camelize.to_sym, name end require File.join(SUPPORT, "sqlite_seed.rb") RSpec.configure do |config| config.before(:suite) do Support::SqliteSeed.setup_db Support::SqliteSeed.seed_db end config.before(:each) do Bullet.start_request end config.after(:each) do Bullet.end_request end end if ENV["LOG"] require 'logger' ActiveRecord::Base.logger = Logger.new(STDOUT) end end if mongoid? # Autoload every mongoid model for the test suite that sits in spec/models. Dir[ File.join(MODELS, "mongoid", "*.rb") ].sort.each { |file| require file } require File.join(SUPPORT, "mongo_seed.rb") RSpec.configure do |config| config.before(:suite) do Support::MongoSeed.setup_db Support::MongoSeed.seed_db end config.after(:suite) do Support::MongoSeed.setup_db Support::MongoSeed.teardown_db end config.before(:each) do Bullet.start_request end config.after(:each) do Bullet.end_request end end if ENV["LOG"] Mongoid.logger = Logger.new(STDOUT) Moped.logger = Logger.new(STDOUT) end end