spec/spec_helper.rb in datadog-notifications-0.6.6 vs spec/spec_helper.rb in datadog-notifications-0.6.7
- old
+ new
@@ -4,10 +4,11 @@
require 'datadog-notifications'
require 'rspec'
require 'rack/test'
require 'grape'
require 'active_record'
+require 'active_job'
require 'sqlite3'
### Active-record test preparation
ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => ':memory:' } }
@@ -16,10 +17,18 @@
t.string :title
end
class Post < ActiveRecord::Base
end
+### Active-job test preparation
+
+ActiveJob::Base.queue_adapter = :inline
+class NoopJob < ActiveJob::Base
+ self.queue_name = 'test:queue'
+ def perform; end
+end
+
### Mocks
module Mock
class Reporter < Datadog::Notifications::Reporter
def timing(stat, _millis, **opts)
@@ -68,9 +77,10 @@
c.hostname = 'test.host'
c.reporter = Mock::Reporter
c.tags = ['custom:tag']
c.use Datadog::Notifications::Plugins::ActiveRecord
+ c.use Datadog::Notifications::Plugins::ActiveJob
c.use Datadog::Notifications::Plugins::Grape,
tags: ['more:tags'],
metric_name: 'api.request',
exception_handler: lambda {|e|
if e.message.include?('unauthorized')