Sha256: 1adff42fee39384e38bb726020dca51dccd648524cc2f21e04c4960edbf72507

Contents?: true

Size: 1.77 KB

Versions: 12

Compression:

Stored size: 1.77 KB

Contents

require "spec_helper"

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 "responding to #add with gchart enabled" do
    it 'should instantiate a grapher and push it to clazz' do
      @graph.clazz.should_receive(:push).with(an_instance_of(RcovGchartGrapher))
      @graph.add("rcov", 'gchart')
    end
  end

  describe "responding to #add with gchart enabled" do
    it 'should instantiate a grapher and push it to clazz' do
      @graph.clazz.should_receive(:push).with(an_instance_of(RcovGchartGrapher))
      @graph.add("rcov", 'gchart')
    end
  end 

  describe "setting the date on the graph" do
    before(:each) do
      @graph.stub!(:puts)
    end

    it "should set the date once for one data point" do
      Dir.should_receive(:[]).and_return(["metric_fu/tmp/_data/20101105.yml"])
      File.should_receive(:join)
      File.should_receive(:open).and_return("Metrics")
      mock_grapher = stub
      mock_grapher.should_receive(:get_metrics).with("Metrics", "11/5")
      mock_grapher.should_receive(:graph!)
     
      @graph.clazz = [mock_grapher]
      @graph.generate
    end

    it "should set the date when the data directory isn't in the default place" do
      Dir.should_receive(:[]).and_return(["/some/kind/of/weird/directory/somebody/configured/_data/20101105.yml"])
      File.should_receive(:join)
      File.should_receive(:open).and_return("Metrics")
      mock_grapher = stub
      mock_grapher.should_receive(:get_metrics).with("Metrics", "11/5")
      mock_grapher.should_receive(:graph!)

      @graph.clazz = [mock_grapher]
      @graph.generate
    end
  end 
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
metric_fu-4.2.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.1.3 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.1.2 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.1.1 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.1.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-4.0.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-3.0.1 spec/metric_fu/metrics/graph_spec.rb
metric_fu-3.0.0 spec/metric_fu/metrics/graph_spec.rb
metric_fu-2.1.4.pre5 spec/metric_fu/metrics/graph_spec.rb
metric_fu-2.1.4.pre4 spec/metric_fu/metrics/graph_spec.rb
metric_fu-2.1.4.pre2 spec/metric_fu/metrics/graph_spec.rb
metric_fu-2.1.4.pre spec/metric_fu/metrics/graph_spec.rb