Sha256: 5d5998745282f61ce6d7bb68d60afc4bdbd65f3dba0bdbbdc222bc04c0224147

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 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 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

2 entries across 2 versions & 1 rubygems

Version Path
slate-0.2.1 spec/slate/calculation/last_spec.rb
slate-0.2.0 spec/slate/calculation/last_spec.rb