Sha256: d0d139b41c6f4f8200830d3dc819bd3670cd1264432c314f9461cc1614228843

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

require "spec_helper"

describe MetricFu::Formatter::YAML do

  before do
    setup_fs

    @metric1 = MetricFu.configuration.mri? ? :cane : :flay
    @metric2 = :hotspots
    MetricFu.result.add(@metric1)
    MetricFu.result.add(@metric2)
  end

  context "In general" do

    it "creates a report yaml file" do
      expect {
      MetricFu::Formatter::YAML.new.finish
      }.to create_file("#{directory('base_directory')}/report.yml")
    end

  end

  context "given a custom output file" do

    before do
      @output = "customreport.yml"
    end

    it "creates a report yaml file to the custom output path" do
      expect {
      MetricFu::Formatter::YAML.new(output: @output).finish
      }.to create_file("#{directory('base_directory')}/customreport.yml")
    end

  end

  context "given a custom output stream" do

    before do
      @output = $stdout
    end

    it "creates a report yaml in the custom stream" do
      out = MfDebugger::Logger.capture_output {
        MetricFu::Formatter::YAML.new(output: @output).finish
      }
      out.should include ":#{@metric1}:"
      out.should include ":#{@metric2}:"
    end

  end

  after do
    cleanup_fs
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metric_fu-4.6.0 spec/metric_fu/formatter/yaml_spec.rb
metric_fu-4.5.2 spec/metric_fu/formatter/yaml_spec.rb
metric_fu-4.5.1 spec/metric_fu/formatter/yaml_spec.rb
metric_fu-4.4.4 spec/metric_fu/formatter/yaml_spec.rb
metric_fu-4.4.3 spec/metric_fu/formatter/yaml_spec.rb
metric_fu-4.4.2 spec/metric_fu/formatter/yaml_spec.rb