Sha256: 4cb6dfe717b6a6919558f8b1c2524bec36d4f913d5ad0e7ad25bb029db9b584d

Contents?: true

Size: 694 Bytes

Versions: 9

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'

require 'active_support/log_subscriber/test_helper'

RSpec.describe 'Rails log subscriber', :postgres do
  before do
    ROM::SQL.load_extensions(:active_support_notifications, :rails_log_subscriber)
  end

  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)
    container.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

9 entries across 9 versions & 1 rubygems

Version Path
rom-sql-1.0.1 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0.rc2 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0.rc1 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0.beta3 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0.beta2 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-1.0.0.beta1 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-0.9.1 spec/integration/support/rails_log_subscriber_spec.rb
rom-sql-0.9.0 spec/integration/support/rails_log_subscriber_spec.rb