Sha256: 9a029056fd18bc34513e809c4de29b69d4ebbd14776abcd5a10b69bdb69fb6b5

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 KB

Contents

require "spec_helper"
MetricFu.metrics_require { 'flay/flay_grapher' }

describe FlayGrapher do
  before :each do
    @flay_grapher = MetricFu::FlayGrapher.new
    MetricFu.configuration
  end

  it "should respond to flay_score and labels" do
    expect(@flay_grapher).to respond_to(:flay_score)
    expect(@flay_grapher).to respond_to(:labels)
  end

  describe "responding to #initialize" do
    it "should initialise flay_score and labels" do
      expect(@flay_grapher.flay_score).to eq([])
      expect(@flay_grapher.labels).to eq({})
    end
  end

  describe "responding to #get_metrics" do
    context "when metrics were not generated" do
      before(:each) do
        @metrics = FIXTURE.load_metric("metric_missing.yml")
        @date = "1/2"
      end

      it "should not push to flay_score" do
        expect(@flay_grapher.flay_score).not_to receive(:push)
        @flay_grapher.get_metrics(@metrics, @date)
      end

      it "should not update labels with the date" do
        expect(@flay_grapher.labels).not_to receive(:update)
        @flay_grapher.get_metrics(@metrics, @date)
      end
    end

    context "when metrics have been generated" do
      before(:each) do
        @metrics = FIXTURE.load_metric("20090630.yml")
        @date = "1/2"
      end

      it "should push to flay_score" do
        expect(@flay_grapher.flay_score).to receive(:push).with(476)
        @flay_grapher.get_metrics(@metrics, @date)
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

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