Sha256: 832f1d80008e6a88d113e4c425af2bd80faa6ac190e0a0c88b938e671dfea15c

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

require "spec_helper"
MetricFu.reporting_require { 'graphs/graph' }

describe MetricFu do

  describe "responding to #graph" do
    it "should return an instance of Graph" do
      expect(MetricFu.graph).to 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

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

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

    # TODO better test
    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"
      expect(MetricFu::Utility).to receive(:glob).and_return([metric_file].sort)
      expect(MetricFu::Utility).to receive(:load_yaml).with(metric_file).and_return("Metrics")
      double_grapher = double
      expect(double_grapher).to receive(:get_metrics).with("Metrics", "11/5")
      expect(double_grapher).to receive(:graph!)

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metric_fu-4.11.3 spec/metric_fu/reporting/graphs/graph_spec.rb
metric_fu-4.11.2 spec/metric_fu/reporting/graphs/graph_spec.rb
metric_fu-4.11.1 spec/metric_fu/reporting/graphs/graph_spec.rb
metric_fu-4.11.0 spec/metric_fu/reporting/graphs/graph_spec.rb