Sha256: 9781015db3201cf04093a12e8d978b9e321394b7d6fa536ecafd12d344f01d35

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'simplecov'
require 'metric_fu/metrics/rcov/simplecov_formatter'

describe SimpleCov::Formatter::MetricFu do
  before do
    @rcov_file =  subject.coverage_file_path
    File.delete( @rcov_file ) if File.exists?( @rcov_file )

    @result = SimpleCov::Result.new(
      {
       FIXTURE.fixtures_path.join('coverage.rb').expand_path.to_s =>
        [1,1,1,1,nil,1,0,1,1,nil,0,1,1]
      }
    )

    # Set to default encoding
    Encoding.default_internal = nil if defined?(Encoding)
  end

  it "test_format" do
    SimpleCov::Formatter::MetricFu.new.format( @result )

    expect(File.exists?( @rcov_file )).to be_truthy
  end

  it "test_encoding" do
    # This is done in many rails environments
    Encoding.default_internal = 'UTF-8' if defined?(Encoding)

    SimpleCov::Formatter::MetricFu.new.format( @result )
  end

  it "test_create_content" do
    content = SimpleCov::Formatter::MetricFu::FormatLikeRCov.new(@result).format
    test = "\="*80

    expect(content).to match(/#{test}/)
    expect(content).to match(/!!     value \* value/)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metric_fu-4.10.0 spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb
metric_fu-4.9.0 spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb