Sha256: 7e639bff6e7839f5182b6430b9975fb2c747a625e2ea578f8e1958ae5decf021

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

require 'spec_helper'
require 'active_support/log_subscriber/test_helper'

describe SequelRails::Railties::LogSubscriber do
  include ActiveSupport::LogSubscriber::TestHelper
  def set_logger(logger)
    SequelRails.configuration.logger = logger
    ActiveSupport::LogSubscriber.logger = logger
  end
  before do
    setup
    described_class.attach_to :sequel
  end
  after { teardown }

  it 'logs queries' do
    User.all
    wait
    expect(@logger.logged(:debug).last).to match(/SELECT \* FROM ("|`)users("|`)/)
  end

  it 'does not log query when logger level is not debug' do
    @logger.level = :info
    User.all
    wait
    expect(@logger.logged(:debug)).to have(:no).line
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sequel-rails-0.9.0 spec/lib/sequel_rails/railties/log_subscriber_spec.rb
sequel-rails-0.8.0 spec/lib/sequel_rails/railties/log_subscriber_spec.rb