Sha256: e9a2c0d7db42e802cf4ce4bff8a235403be5d03dee73014ca148566d2c43a2f2

Contents?: true

Size: 672 Bytes

Versions: 6

Compression:

Stored size: 672 Bytes

Contents

require 'spec_helper'

require 'rom/sql/support/active_support_notifications'
require 'rom/sql/support/rails_log_subscriber'

require 'active_support/log_subscriber/test_helper'

describe 'Rails log subscriber' do
  include ActiveSupport::LogSubscriber::TestHelper

  include_context 'database setup'

  let(:test_query) do
    %(SELECT * FROM "users" WHERE name = 'notification test')
  end

  let(:logger) { ActiveSupport::LogSubscriber::TestHelper::MockLogger.new }

  before do
    set_logger(logger)
    rom.gateways[:default].use_logger(logger)
  end

  it 'works' do
    conn.run(test_query)

    expect(logger.logged(:debug).last).to include(test_query)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-sql-0.6.1 spec/support/rails_log_subscriber_spec.rb
rom-sql-0.6.0 spec/support/rails_log_subscriber_spec.rb
rom-sql-0.6.0.rc1 spec/support/rails_log_subscriber_spec.rb
rom-sql-0.6.0.beta1 spec/support/rails_log_subscriber_spec.rb
rom-sql-0.5.3 spec/support/rails_log_subscriber_spec.rb
rom-sql-0.5.2 spec/support/rails_log_subscriber_spec.rb