Sha256: d5d12225ad345a4a47d0e4643431ff52cf36d7aebb43981be89a64df8e8c3c13

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 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::Client.new(['127.0.0.1:27017'], database: database_name).database
  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

5 entries across 5 versions & 4 rubygems

Version Path
mongo_session_store-rails5-7.0.0.1 spec/rails_helper.rb
mongo_session_store-rails5-7.0.0 spec/rails_helper.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo_session_store-rails4-6.0.0/spec/rails_helper.rb
mongo_session_store-rails3-6.0.0 spec/rails_helper.rb
mongo_session_store-rails4-6.0.0 spec/rails_helper.rb