Sha256: 39910b83cca504a7a965e71caa0eb0e3b40a5dd3289acf85d8c1517da807704b

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

require 'spec_helper'

describe Datadog::Notifications::Plugins::ActiveRecord do

  it 'should send an increment and timing event for each query' do
    Post.all.to_a
    expect(buffered).to eq [
      'activerecord.sql:1|c|#custom:tag,env:test,host:test.host,query:post.load',
      'activerecord.sql.time:333|ms|#custom:tag,env:test,host:test.host,query:post.load',
    ]
  end

  it 'should support custom queries' do
    Post.find_by_sql('SELECT * FROM posts LIMIT 1').to_a
    expect(buffered).to eq [
      'activerecord.sql:1|c|#custom:tag,env:test,host:test.host,query:post.load',
      'activerecord.sql.time:333|ms|#custom:tag,env:test,host:test.host,query:post.load',
    ]
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datadog-notifications-0.6.2 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.6.1 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.6.0 spec/datadog/notifications/plugins/active_record_spec.rb