Sha256: a22a73029f985305e535984c957498df52d9bb967a3d83fe60afd2fce11edf3d

Contents?: true

Size: 743 Bytes

Versions: 5

Compression:

Stored size: 743 Bytes

Contents

require 'spec_helper'

describe "Alerts", :vcr => true do

  before(:all) do
    @api_key = ENV["DATADOG_API_KEY"]
    @app_key = ENV["DATADOG_APP_KEY"]
    @dog = Dogapi::Client.new(@api_key, @app_key)
    @query = 'avg(last_10m):avg:test.metric.metric{host:test.metric.host} > 5'
  end

  context "create" do
    before(:each) do
      @new_alert = @dog.alert(@query)
    end
    after(:each) do
      @dog.delete_alert(@new_alert[1]['id'])
    end

    it "returns HTTP code 201" do
      expect(@new_alert[0]).to eq '201'
    end

    it "returns a valid event ID" do
      expect(@new_alert[1]['id']).to be_a(Fixnum)
    end

    it "returns the same query as sent" do
      expect(@new_alert[1]['query']).to eq @query
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dogapi-1.11.0 spec/alerts_spec.rb
dogapi-1.10.0 spec/alerts_spec.rb
dogapi-1.9.2 spec/alerts_spec.rb
dogapi-1.9.1 spec/alerts_spec.rb
dogapi-1.9.0 spec/alerts_spec.rb