Sha256: c43c41316e99eb5aef0e3bcfcadcdf9a2fd05b925987ca930ac0aec6fe7834d1

Contents?: true

Size: 811 Bytes

Versions: 13

Compression:

Stored size: 811 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 skip unnamed by default' do
    Post.create!(title: "Hello!")
    expect(buffered).to eq([])
  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

13 entries across 13 versions & 1 rubygems

Version Path
datadog-notifications-0.5.0 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.9 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.8 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.7 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.6 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.5 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.4 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.3 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.2 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.1 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.4.0 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.3.1 spec/datadog/notifications/plugins/active_record_spec.rb
datadog-notifications-0.3.0 spec/datadog/notifications/plugins/active_record_spec.rb