Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (37 sloc) 1.53 KB
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
MODELS = File.join(File.dirname(__FILE__), "models")
SUPPORT = File.join(File.dirname(__FILE__), "support")
require "mongoid"
require "mocha"
require "rspec"
LOGGER =$stdout)
Mongoid.configure do |config|
name = "mongoid_test"
config.master =
config.logger = nil
Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require File.basename(file) }
Dir[ File.join(SUPPORT, "*.rb") ].each { |file| require File.basename(file) }
RSpec.configure do |config|
config.after(:suite) { Mongoid.purge! }
# We filter out the specs that require authentication if the database has not
# had the mongoid user set up properly.
user_configured = Support::Authentication.configured?
warn(Support::Authentication.message) unless user_configured
# We filter out specs that require authentication to MongoHQ if the
# environment variables have not been set up locally.
mongohq_configured = Support::MongoHQ.configured?
warn(Support::MongoHQ.message) unless mongohq_configured
config.filter_run_excluding(:config => lambda { |value|
return true if value == :mongohq && !mongohq_configured
return true if value == :user && !user_configured
# config.filter_run :focus => true
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular("address_components", "address_component")
Something went wrong with that request. Please try again.