Sha256: b51f0894f62c8ca470bcece67d7934510670142162e5d658f1e5b90ff652e04d

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require_relative "../spec_helper"

describe LogStash::Outputs::PagerDuty do

  it "should register without errors" do
    plugin = LogStash::Plugin.lookup("output", "pagerduty").new("service_key" => "")
    expect { plugin.register }.to_not raise_error
  end

  describe "#send" do
    subject          { LogStash::Outputs::PagerDuty.new( "service_key" => "my_service_key" ) }
    let(:properties) { { "message" => "This is a message!" } }
    let(:event)      { LogStash::Event.new(properties) }
    let(:logger)     { subject.logger }

    before(:each) do
      subject.register
    end

    it "send the event to pagerduty" do
      stub_request(:post, /#{subject.pdurl}/).
        to_return(status: 200, body: "stubbed response", headers: {})
      expect(logger).to receive(:debug).with("PD Response", :response => "stubbed response").once
      expect(logger).to receive(:debug).with("PD Request", kind_of(Hash)).once
      expect(logger).to receive(:debug).with("PD Details added:", kind_of(Hash)).twice
      subject.receive(event)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
logstash-output-pagerduty-3.0.2 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-3.0.1 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-3.0.0 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-2.0.4 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-2.0.2 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-2.0.1 spec/outputs/pagerduty_spec.rb
logstash-output-pagerduty-2.0.0 spec/outputs/pagerduty_spec.rb