Sha256: f8a3bef22817c223cf07ede71b462e885e5005d6509076467c2d3dcabc48493a

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require "spec_helper"
MetricFu.metrics_require { 'graph' }

describe MetricFu do

  describe "responding to #graph" do
    it "should return an instance of Graph" do
      MetricFu.graph.should be_a(Graph)
    end
  end
end

describe MetricFu::Graph do

  before(:each) do
    @graph = MetricFu::Graph.new
  end

  describe "setting the date on the graph" do

    it "should set the date once for one data point" do
      metric_file = "metric_fu/tmp/_data/20101105.yml"
      MetricFu::Utility.should_receive(:glob).and_return([metric_file].sort)
      MetricFu::Utility.should_receive(:load_yaml).with(metric_file).and_return("Metrics")
      double_grapher = double
      double_grapher.should_receive(:get_metrics).with("Metrics", "11/5")
      double_grapher.should_receive(:graph!)

      @graph.graphers = [double_grapher]
      @graph.generate
    end

    it "should set the date when the data directory isn't in the default place" do
      metric_file = "/some/kind/of/weird/directory/somebody/configured/_data/20101105.yml"
      MetricFu::Utility.should_receive(:glob).and_return([metric_file].sort)
      MetricFu::Utility.should_receive(:load_yaml).with(metric_file).and_return("Metrics")
      double_grapher = double
      double_grapher.should_receive(:get_metrics).with("Metrics", "11/5")
      double_grapher.should_receive(:graph!)

      @graph.graphers = [double_grapher]
      @graph.generate
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metric_fu-4.6.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.5.2 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.5.1 spec/metric_fu/metrics/graph_spec.rb