Sha256: af48b04daf71dd43e21646d3b4b7a8320252b4ea867a9bb730c22a5220dbc5f9

Contents?: true

Size: 620 Bytes

Versions: 5

Compression:

Stored size: 620 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 == 1.5
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slate-0.1.0 spec/slate/calculation/mean_spec.rb
slate-0.0.5 spec/slate/calculation/mean_spec.rb
slate-0.0.4 spec/slate/calculation/mean_spec.rb
slate-0.0.3 spec/slate/calculation/mean_spec.rb
slate-0.0.2 spec/slate/calculation/mean_spec.rb