Sha256: 533f5306f98e9c9516435dd2aeb5a2f8b2813d14f75f39704c062eacb10240d2

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

ENV["MONGO_SESSION_STORE_ORM"] ||= "mongo_mapper"
ENV["RAILS_ENV"] = "test"

$:.unshift File.dirname(__FILE__)

require 'rails'

rails_version = Rails.version[/^\d\.\d/]
require "rails_#{rails_version}_app/config/environment"

require 'rspec/rails'

def db
  Mongo::Connection.new[database_name]
end

def database_name
  Rails.application.class.to_s.underscore.sub(/\/.*/, '') + "_" + Rails.env
end

def drop_collections_in(database)
  database.collections.select { |c| c.name !~ /^system/ }.each(&:drop)
end

RSpec.configure do |config|
  config.before :each do
    drop_collections_in(Mongoid.database) if defined?(Mongoid)
    drop_collections_in(MongoMapper.database) if defined?(MongoMapper)
    drop_collections_in(db)
  end
end

puts "Testing #{ENV["MONGO_SESSION_STORE_ORM"]}_store on Rails #{Rails.version}..."

case ENV["MONGO_SESSION_STORE_ORM"]
when "mongo_mapper"
  puts "MongoMapper version: #{MongoMapper::Version}"
when "mongoid"
  puts "Mongoid version: #{Mongoid::VERSION}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_session_store-rails3-3.0.4 spec/spec_helper.rb