Sha256: 0521815ed82186f373996f40d6b6336e8a1f9f37479e90b9a98476b4d8f6266e

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')

describe Slate::Calculation::Mean 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::Mean.new(@graph)
    calculation.result.should == [{ "name" => "some.stat", "value" => 1.5 }]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slate-1.0.0 spec/lib/slate/calculation/mean_spec.rb