Sha256: 73ec523fd52e88307e244e746d66ad83a94ec7d65cc64cbb33d1b95fee10b66f

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

# require 'pry'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

MODELS = File.join(File.dirname(__FILE__), 'models')
SUPPORT = File.join(File.dirname(__FILE__), 'support')
$LOAD_PATH.unshift(MODELS)
$LOAD_PATH.unshift(SUPPORT)

if ENV['CI']
  # require "simplecov"
  require 'coveralls'
  Coveralls.wear!
  # SimpleCov.formatter = Coveralls::SimpleCov::Formatter
  # SimpleCov.start do
  #  add_filter "spec"
  # end
end

require 'mongoid'
# require "mocha"
require 'rspec'
require 'mongoid/geospatial'

# These environment variables can be set if wanting to test against a database
# that is not on the local machine.
ENV['MONGOID_SPEC_HOST'] ||= 'localhost'
ENV['MONGOID_SPEC_PORT'] ||= '27018'

# These are used when creating any connection in the test suite.
HOST = ENV['MONGOID_SPEC_HOST']
PORT = ENV['MONGOID_SPEC_PORT'].to_i

LOGGER = Logger.new($stdout)

if RUBY_VERSION >= '1.9.2'
  YAML::ENGINE.yamler = 'syck'
end

puts "Running with Mongoid v#{Mongoid::VERSION}"

Mongoid.configure do |config|
  config.connect_to('mongoid_geo_test')
end

# Autoload every model for the test suite that sits in spec/app/models.
Dir[File.join(MODELS, '*.rb')].sort.each do |file|
  name = File.basename(file, '.rb')
  autoload name.camelize.to_sym, name
end

Dir[File.join(SUPPORT, '*.rb')].each { |file| require File.basename(file) }

def bson_object_id_class
  Moped::BSON::ObjectId
end

RSpec.configure do |config|
  # config.mock_with(:mocha)

  config.before(:each) do
    Mongoid.purge!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-geospatial-3.9.0 spec/spec_helper.rb