Sha256: 55bc7771545b0b9a41c82cfca6ea412e62ee351aab9d54caab9e3b939b3f7083

Contents?: true

Size: 1.28 KB

Versions: 18

Compression:

Stored size: 1.28 KB

Contents

require "helper"

describe SimpleCov::Result do
  subject do
    original_result = {
      source_fixture("sample.rb") => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
      source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
      source_fixture("app/controllers/sample_controller.rb") => [nil, 2, 2, 0, nil, nil, 0, nil, nil, nil],
    }
    SimpleCov::Result.new(original_result).files
  end

  it "has 11 covered lines" do
    expect(subject.covered_lines).to eq(11)
  end

  it "has 3 missed lines" do
    expect(subject.missed_lines).to eq(3)
  end

  it "has 19 never lines" do
    expect(subject.never_lines).to eq(19)
  end

  it "has 14 lines of code" do
    expect(subject.lines_of_code).to eq(14)
  end

  it "has 3 skipped lines" do
    expect(subject.skipped_lines).to eq(3)
  end

  it "has the correct covered percent" do
    expect(subject.covered_percent).to eq(78.57142857142857)
  end

  it "has the correct covered percentages" do
    expect(subject.covered_percentages).to eq([50.0, 80.0, 100.0])
  end

  it "has the correct least covered file" do
    expect(subject.least_covered_file).to match(/sample_controller.rb/)
  end

  it "has the correct covered strength" do
    expect(subject.covered_strength).to eq(0.9285714285714286)
  end
end if SimpleCov.usable?

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/simplecov-0.12.0/spec/file_list_spec.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/simplecov-0.12.0/spec/file_list_spec.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/simplecov-0.12.0/spec/file_list_spec.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/simplecov-0.12.0/spec/file_list_spec.rb
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
simplecov-0.12.0 spec/file_list_spec.rb
cvss-suite-1.0.7 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.6 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.5 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.4 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.3 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.2 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.1 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
cvss-suite-1.0.0 vendor/cache/ruby/2.2.0/gems/simplecov-0.11.2/spec/file_list_spec.rb
simplecov-0.11.2 spec/file_list_spec.rb
simplecov-0.11.1 spec/file_list_spec.rb
simplecov-0.11.0 spec/file_list_spec.rb