spec/spec_helper.rb in datadog-notifications-0.5.0 vs spec/spec_helper.rb in datadog-notifications-0.5.1
- old
+ new
@@ -20,17 +20,20 @@
### Mocks
module Mock
class Reporter < Datadog::Notifications::Reporter
- def timing(stat, ms, opts={}); super(stat, 333, opts); end
+ def timing(stat, _ms, opts={})
+ super(stat, 333, opts)
+ end
+
def flush_buffer; end
@should_batch = true
end
class Instrumentable
- def initialize(opts = {})
+ def initialize(opts={})
@opts = opts
end
def perform
ActiveSupport::Notifications.instrument("mock.start", @opts)
@@ -63,7 +66,13 @@
c.use Datadog::Notifications::Plugins::ActiveRecord
c.use Datadog::Notifications::Plugins::Grape,
tags: ["more:tags"],
metric_name: "api.request",
- exception_handler: ->e { e.message.include?("unauthorized") ? 401 : 500 }
+ exception_handler: lambda {|e|
+ if e.message.include?('unauthorized')
+ 401
+ else
+ Datadog::Notifications::Plugins::Grape.exception_status(e)
+ end
+ }
end