Sha256: 1e196b54b754097e3985ccea697705601c02efcded6c1abb7176e10974a9ec3b

Contents?: true

Size: 1.73 KB

Versions: 20

Compression:

Stored size: 1.73 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe RoodiGrapher do
  before :each do
    @roodi_grapher = MetricFu::RoodiGrapher.new
    MetricFu.configuration
  end

  it "should respond to roodi_count and labels" do
    @roodi_grapher.should respond_to(:roodi_count)
    @roodi_grapher.should respond_to(:labels)
  end

  describe "responding to #initialize" do
    it "should initialise roodi_count and labels" do
      @roodi_grapher.roodi_count.should == []
      @roodi_grapher.labels.should == {}
    end
  end

  describe "responding to #get_metrics" do
    context "when metrics were not generated" do
      before(:each) do
        @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
        @date = "1/2"
      end

      it "should not push to roodi_count" do
        @roodi_grapher.roodi_count.should_not_receive(:push)
        @roodi_grapher.get_metrics(@metrics, @date)
      end

      it "should not update labels with the date" do
        @roodi_grapher.labels.should_not_receive(:update)
        @roodi_grapher.get_metrics(@metrics, @date)
      end
    end

    context "when metrics have been generated" do
      before(:each) do
        @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
        @date = "1/2"
      end

      it "should push to roodi_count" do
        @roodi_grapher.roodi_count.should_receive(:push).with(13)
        @roodi_grapher.get_metrics(@metrics, @date)
      end

      it "should update labels with the date" do
        @roodi_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
        @roodi_grapher.get_metrics(@metrics, @date)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
metric_fu-2.1.3.7.18.1 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.3.7.19 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.3.6 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.3.5 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.3.4 spec/graphs/roodi_grapher_spec.rb
bf4-metric_fu-2.1.3.4 spec/graphs/roodi_grapher_spec.rb
bf4-metric_fu-2.1.3.3 spec/graphs/roodi_grapher_spec.rb
bf4-metric_fu-2.1.3.2 spec/graphs/roodi_grapher_spec.rb
bf4-metric_fu-2.1.3.1 spec/graphs/roodi_grapher_spec.rb
danmayer-metric_fu-2.1.3 spec/graphs/roodi_grapher_spec.rb
danmayer-metric_fu-2.1.2 spec/graphs/roodi_grapher_spec.rb
rferraz-metric_fu-2.1.2 spec/graphs/roodi_grapher_spec.rb
rferraz-metric_fu-2.1.1 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.1 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.1.0 spec/graphs/roodi_grapher_spec.rb
goldstar-metric_fu-1.5.1.2 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.0.1 spec/graphs/roodi_grapher_spec.rb
metric_fu-2.0.0 spec/graphs/roodi_grapher_spec.rb
goldstar-metric_fu-1.5.1.1 spec/graphs/roodi_grapher_spec.rb
metric_fu-1.5.1 spec/graphs/roodi_grapher_spec.rb