Sha256: c36fb7e6eee627fadb592caafb5aa1dc53b10922c5de64efdda4d7520c3c91e7

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require "mongo"
require "mongoid" if Gem.loaded_specs["mongoid"]
require "mongo_session_store"
require "support/helpers/test_database_helper"
require "support/helpers/session_id_helper"

def mongo_orm
  defined?(Mongoid) ? "mongoid" : "mongo"
end

case mongo_orm
when "mongo"
  require "mongo_session_store/mongo_store"
when "mongoid"
  require "mongo_session_store/mongoid_store"
end

RSpec.configure do |config|
  config.include TestDatabaseHelper
  config.include SessionIdHelper

  config.order = "random"
  config.mock_with :rspec do |c|
    c.syntax = :expect
  end

  config.before :suite do
    Mongo::Logger.logger.level = ::Logger::INFO

    if mongo_orm == "mongoid"
      Mongoid.logger.level = Logger::INFO
      Mongoid.configure do |c|
        c.load_configuration(
          "clients" => {
            "default" => {
              "database" => TestDatabaseHelper.test_database_name,
              "hosts" => ["127.0.0.1:27017"]
            }
          }
        )
      end
    else
      MongoStore::Session.database = Mongo::Client.new(
        ["127.0.0.1:27017"],
        :database => TestDatabaseHelper.test_database_name
      )
    end
  end

  config.before do
    drop_collections_in(test_database)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo_session_store-3.2.1 spec/spec_helper.rb
mongo_session_store-3.2.0 spec/spec_helper.rb
mongo_session_store-3.1.0 spec/spec_helper.rb
mongo_session_store-3.0.0 spec/spec_helper.rb
mongo_session_store-3.0.0.beta.1 spec/spec_helper.rb