Skip to content

Instantly share code, notes, and snippets.

@rivant
Created October 29, 2015 20:26
Show Gist options
  • Select an option

  • Save rivant/a7b23563aad6015e59f9 to your computer and use it in GitHub Desktop.

Select an option

Save rivant/a7b23563aad6015e59f9 to your computer and use it in GitHub Desktop.
event_spec and event
describe '#event' do
it 'submits a custom event to data dog' do
datadog = HL7Engine::Interfaces::Labs2Go::DataDog.new(
env: ENV, pass: true, response: 'AA', stat: '[email protected]', title: 'T'
)
dog = double
event = double
time = double
allow(Time).to receive(:now).and_return(time)
allow(Dogapi::Event).to receive(:new).with(
'Message', msg_title: 'Title', date_happened: time,
alert_type: 'Success', tags: 'HL7'
).and_return(event)
allow(Dogapi::Client).to receive(:new).with(
ENV['DATADOG_API']).and_return(dog)
expect(dog).to receive(:emit_event).with(event)
datadog.event('Title', 'Message', 'Success')
end
end
def event(title, message, status, tag = 'HL7')
dog.emit_event(
Dogapi::Event.new(
message,
msg_title: title,
date_happened: Time.now,
alert_type: status,
tags: tag)
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment