Created
October 29, 2015 20:26
-
-
Save rivant/a7b23563aad6015e59f9 to your computer and use it in GitHub Desktop.
event_spec and event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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