Sha256: 3ab81cb72b688d14c9be31d98ade54ac31d5d6a49b3658eb04a95a92d3c16fc8

Contents?: true

Size: 1.6 KB

Versions: 20

Compression:

Stored size: 1.6 KB

Contents

require "spec_helper"

describe RcovGrapher do
  before :each do
    @rcov_grapher = MetricFu::RcovGrapher.new
    MetricFu.configuration
  end

  it "should respond to rcov_percent and labels" do
    @rcov_grapher.should respond_to(:rcov_percent)
    @rcov_grapher.should respond_to(:labels)
  end

  describe "responding to #initialize" do
    it "should initialise rcov_percent and labels" do
      @rcov_grapher.rcov_percent.should == []
      @rcov_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("#{resources_path}/yml/metric_missing.yml"))
        @date = "1/2"
      end

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

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

    context "when metrics have been generated" do
      before(:each) do
        @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
        @date = "1/2"
      end

      it "should push to rcov_percent" do
        @rcov_grapher.rcov_percent.should_receive(:push).with(49.6)
        @rcov_grapher.get_metrics(@metrics, @date)
      end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
metric_fu-4.4.4 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.4.3 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.4.2 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.4.1 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.4.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.3.1 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.3.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.2.1 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.2.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.1.3 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.1.2 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.1.1 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.1.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-4.0.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-3.0.1 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-3.0.0 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-2.1.4.pre5 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-2.1.4.pre4 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-2.1.4.pre2 spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb
metric_fu-2.1.4.pre spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb