require 'spec_helper' module Falcore describe Dumper::Statsd, :integration do let(:config) do Config.parse <<-EOH.gsub(/^ {8}/, '') [jenkins] endpoint = http://master.jenkins.example.com [statsd] host = #{RSpec::Statsd.host} port = #{RSpec::Statsd.port} EOH end let(:aggregator) { Aggregator.new(config) } let(:master) { aggregator.run } let(:statsd) { RSpec::Statsd.query("gauges *") } subject { Dumper::Statsd.new(config, master) } it 'validates config.statsd.host is present' do config.statsd.host = nil expect { subject.run }.to raise_error(RuntimeError, "Expected 'Statsd host' to be set!") end it 'validates config.statsd.port is present' do config.statsd.port = nil expect { subject.run }.to raise_error(RuntimeError, "Expected 'Statsd port' to be set!") end it 'adds the offline status' do subject.run expect(statsd).to include("'jenkins.master-jenkins-example-com.offline': 0") end end end