Sha256: dce430ca35ee5a2f73eb3af755d756230f0188c181433eef393dd02e955c3540

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

require 'spec_helper'

require 'rom/sql/support/active_support_notifications'
require 'active_support/log_subscriber'

describe 'ActiveSupport::Notifications support' do
  include_context 'database setup'

  it 'works' do
    rom.postgres.use_logger(LOGGER)

    sql = nil

    ActiveSupport::Notifications.subscribe('sql.rom') do |_name, _start, _finish, _id, payload|
      sql = payload[:sql]
    end

    rom.postgres.connection.run(%(SELECT * FROM "users" WHERE name = 'notification test'))

    expect(sql).to eql(%(SELECT * FROM "users" WHERE name = 'notification test'))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-sql-0.3.2 spec/support/active_support_notifications_spec.rb
rom-sql-0.3.1 spec/support/active_support_notifications_spec.rb