Sha256: 93d692752d88caf9e4ad6f33ee41bf6b0f678bf4bbb6a4c854ba43c8a392ef30

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 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.0 spec/support/active_support_notifications_spec.rb
rom-sql-0.2.0 spec/support/active_support_notifications_spec.rb