Sha256: 5aec11ba59dbcc0724c0c9cea73372a254b96ff19ab2824f2015b4812c8cfc1a
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require "spec_helper" module Sidewatch describe Cloudwatch do let(:client){ spy("cloudwatch-client") } subject{ described_class.new(client: client) } describe "#send" do it "sends the metrics using the cloudwatch client" do metrics = [] metrics << Metric.new(namespace: "Clocks", name: "Ticks", value: 1234, unit: "Count", dimensions: { "ClockName" => "cuckoo" }, timestamp: Time.at(1440494300)) expected = { namespace: "Clocks", metric_data: [ { metric_name: "Ticks", dimensions: [ { name: "ClockName", value: "cuckoo" } ], timestamp: Time.at(1440494300), value: 1234, unit: "Count" } ] } subject.send(metrics) expect(client).to have_received(:put_metric_data).with(expected) end it "groups the metrics by namespace" do metrics = [] metrics << Metric.new(namespace: "Clocks", name: "Ticks", value: 1234, unit: "Count") metrics << Metric.new(namespace: "Events", name: "Failed", value: 55, unit: "Count") received = [] allow(client).to receive(:put_metric_data){ |data| received << data } subject.send(metrics) expect(received).to contain_exactly(hash_including(namespace: "Clocks"), hash_including(namespace: "Events")) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sidewatch-0.0.3 | spec/cloudwatch_spec.rb |
sidewatch-0.0.2 | spec/cloudwatch_spec.rb |
sidewatch-0.0.1 | spec/cloudwatch_spec.rb |