Sha256: e8f2fd0ca715229083d4919affb7dc3757496b0b8638a6cc2c492f6239fa8712

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Datadog::Notifications::Config do

  it 'should be connect!' do
    subject.reporter = Mock::Reporter
    subject.hostname = "test.host"
    subject.tags = ["custom:tag"]

    client = subject.send(:connect!)
    expect(client).to be_instance_of(Mock::Reporter)
    expect(subject.tags).to eq(["custom:tag", "env:test", "host:test.host"])
  end

  RSpec.shared_examples 'host tag is not picked up' do |hostname|
    it 'should not pick up the host tag' do
      subject.reporter = Mock::Reporter
      subject.hostname = hostname
      subject.tags = ["custom:tag"]

      client = subject.send(:connect!)
      expect(client).to be_instance_of(Mock::Reporter)
      expect(subject.tags).to eq(["custom:tag", "env:test"])
    end
  end

  include_examples 'host tag is not picked up', false
  include_examples 'host tag is not picked up', 'false'

  it 'should instantiate plugins on use' do
    subject.use Datadog::Notifications::Plugins::ActionController
    expect(subject.plugins.size).to eq(1)
    expect(subject.plugins.first).to be_instance_of(Datadog::Notifications::Plugins::ActionController)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datadog-notifications-0.5.4 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.5.3 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.5.2 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.5.1 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.5.0 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.4.9 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.4.8 spec/datadog/notifications/config_spec.rb
datadog-notifications-0.4.7 spec/datadog/notifications/config_spec.rb