spec/lib/metricize_spec.rb in metricize-0.5.4 vs spec/lib/metricize_spec.rb in metricize-0.5.6
- old
+ new
@@ -31,11 +31,11 @@
expect(api_url).to eq("https://name%40example.com:api_key@metrics-api.librato.com/v1/metrics")
first_gauge = JSON.parse(post_data)['gauges'].first
expect(first_gauge['name']).to eq "prefix.stat.name.count"
expect(first_gauge['source']).to eq "my_source"
expect(first_gauge['attributes']).to eq("source_aggregate" => true, "summarize_function" => "sum")
- expect(request_params).to eq( :timeout => 10, :content_type => "application/json" )
+ expect(request_params).to eq( :timeout => 12, :content_type => "application/json" )
end
forwarder.go!
end
it "sends stats when requested with go!" do
@@ -219,14 +219,15 @@
end
end
it "times and reports the execution of a block of code in milliseconds" do
- client.time('my_slow_code') do
+ client.time('my_slow_code', source: 'my_source') do
Timecop.travel(5) # simulate 5000 milliseconds of runtime
end
RestClient.should_receive(:post).with do | _, post_data |
first_gauge = JSON.parse(post_data)['gauges'].first
+ expect(first_gauge['source']).to eq('my_source')
expect(first_gauge['name']).to eq('prefix.my_slow_code.time')
expect(first_gauge['value']).to be_within(0.2).of(5000)
end
forwarder.go!
end