Sha256: 75fb12883b0bbf07e468c132c7a05dc0b0151a74fb6c06b9e0f363cef32cf361
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' require 'rails' rails_version = Rails.version[/^\d\.\d/] require "rails_#{rails_version}_app/config/environment" require 'rspec/rails' def db if defined?(Mongoid) MongoidStore::Session.mongo_session elsif defined?(MongoMapper) MongoMapper.database elsif defined?(Mongo) Mongo::Connection.new[database_name] end 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 :all do unless User.table_exists? load Rails.root.join('db', 'schema.rb') end end config.before :each do drop_collections_in(db) User.delete_all 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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mongo_session_store-rails3-5.1.0 | spec/rails_helper.rb |
mongo_session_store-rails4-5.1.0 | spec/rails_helper.rb |