Sha256: 65e3c2c857b28382dacea1d44f04ee06bfa2f86e3d325da10d4ff399ca40ab12

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

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

8 entries across 8 versions & 1 rubygems

Version Path
metric_fu-4.10.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.9.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.8.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.7.4 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.7.3 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.7.2 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.7.1 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.7.0 spec/metric_fu/metrics/graph_spec.rb