Sha256: 122247e9588f37eb6cd9abafca28b3cce8efd487fa47e6bc9743c218af835a18

Contents?: true

Size: 576 Bytes

Versions: 6

Compression:

Stored size: 576 Bytes

Contents

module NotificationsSupport

  def self.included(base)
    base.class_eval do
      after(:each) do
        ActiveSupport::Notifications.notifier.instance_variable_set(:@subscribers, [])
        ActiveSupport::Notifications.notifier.instance_variable_set(:@listeners_for, {})
      end
    end
  end

  def event(options={})
    SystemMetrics::NestedEvent.new(
      options[:name] || 'sql.active_record',
      options[:start] || (Time.now - 5.seconds),
      options[:end] || Time.now,
      options[:transaction_id] || 'tid',
      options[:payload] || {}
    )
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
system-metrics-0.2.5 spec/support/notifications_support.rb
system-metrics-0.2.4 spec/support/notifications_support.rb
system-metrics-0.2.3 spec/support/notifications_support.rb
system-metrics-0.2.2 spec/support/notifications_support.rb
system-metrics-0.2.1 spec/support/notifications_support.rb
system-metrics-0.2.0 spec/support/notifications_support.rb