Sha256: d72c75e8f2ffca05be347434bc3cefb8be7b439a3c80c43d2b058ed08054f27d

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

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