Sha256: 8107ff95a98bac1479e5d213d37464f6cd53043ed41e582c9da8cbaaf6c21e94

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 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}..."

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo_session_store-rails3-3.0.3 spec/spec_helper.rb
mongo_session_store-rails3-3.0.2 spec/spec_helper.rb
mongo_session_store-rails3-3.0.1 spec/spec_helper.rb