Sha256: 952879fc6bb0eeba9ced0629506ae1436affb3fbbc12550ae0c152d63d9592b4

Contents?: true

Size: 1.49 KB

Versions: 9

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

9 entries across 9 versions & 3 rubygems

Version Path
metric_fu-4.13.0 spec/metric_fu/reporting/graphs/graph_spec.rb
fastruby-metric_fu-5.0.0 spec/metric_fu/reporting/graphs/graph_spec.rb
code_metric_fu-4.14.4 spec/metric_fu/reporting/graphs/graph_spec.rb
code_metric_fu-4.14.3 spec/metric_fu/reporting/graphs/graph_spec.rb
code_metric_fu-4.14.2 spec/metric_fu/reporting/graphs/graph_spec.rb
code_metric_fu-4.14.1 spec/metric_fu/reporting/graphs/graph_spec.rb
code_metric_fu-4.14.0 spec/metric_fu/reporting/graphs/graph_spec.rb
metric_fu-4.12.0 spec/metric_fu/reporting/graphs/graph_spec.rb
metric_fu-4.11.4 spec/metric_fu/reporting/graphs/graph_spec.rb