Sha256: 939d116bc2ea624cd89d880637f28136de954a777bcb9df853e93a5a9f826fe6
Contents?: true
Size: 951 Bytes
Versions: 17
Compression:
Stored size: 951 Bytes
Contents
# encoding: utf-8 require "logstash/instrument/metric_type/gauge" require "logstash/json" require "spec_helper" describe LogStash::Instrument::MetricType::Gauge do let(:namespaces) { [:root, :pipelines, :pipeline_01] } let(:key) { :mykey } let(:value) { "hello" } subject { described_class.new(namespaces, key) } before :each do subject.execute(:set, value) end describe "#execute" do it "set the value of the gauge" do expect(subject.value).to eq(value) end end context "When serializing to JSON" do it "serializes the value" do expect(LogStash::Json.dump(subject)).to eq("\"#{value}\"") end end context "When creating a hash " do it "creates the hash from all the values" do metric_hash = { "key" => key, "namespaces" => namespaces, "value" => value, "type" => "gauge" } expect(subject.to_hash).to match(metric_hash) end end end
Version data entries
17 entries across 17 versions & 1 rubygems