Sha256: 1fbe7c512c747f215a86ba2b2e3aa28895654f81b855be5c5f54181410621f0a
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') describe Slate::Calculation::Last do before do @graph = Slate::Graph.new(:target => "some.stat") data = [ { "target" => "some.stat", "datapoints" => [ [1.0, 1352143990], [0.0, 1352144000], [2.0, 1352145000], [3.0, 1352146000] ] } ] @graph.stubs(:download).with(:json).returns(JSON.generate(data)) end it "should have a name" do Slate::Calculation::Last.name.should == "Last Point" end it "should have a description" do Slate::Calculation::Last.description.should == "Returns the last point in each of the targets." end it "should calculate the mean of the series" do calculation = Slate::Calculation::Last.new(@graph) calculation.result.should == [{ "name" => "some.stat", "value" => 3.0 }] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slate-1.0.1 | spec/lib/slate/calculation/last_spec.rb |