Sha256: aaaf692de130882fc840fbca7dbfc29421e39517d31b3805743599597b2ba372

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

require 'spec_helper'
require 'mongo_request_logger'
require 'moped'
require 'shared_examples'

include MongoRequestLogger

describe 'MongoRequestLogger::Logger with moped' do
  before do
    session = Moped::Session.new(%w(127.0.0.1:27017))
    session.use "request_logger_test"
    begin
      session.login("request_logger_test", "test_password")
      session.command(ping: 1)
    rescue Moped::Errors::AuthenticationFailure => e
      session.logout
      session.command(ping: 1)
    end

    session['server_log'].drop rescue nil


    config = {
        database: 'request_logger_test',
        collection: 'server_log',
        capsize: 10 * 1024 * 1024,
    }
    @adapter = MongoRequestLogger::Adapters::Moped.new(config)

    @file = 'test-log.txt'
    FileUtils.remove @file, :force => true
  end

  after do
    FileUtils.remove @file, :force => true
  end

  include_examples "log"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_request_logger-0.1.0 spec/moped_logger_spec.rb