Sha256: 422994d319c0e9108b18eedd360525a4bcc1603709a90db450851736712170e7

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require File.expand_path('../../test_helper', File.dirname(__FILE__))

####
# Thanks for all the help SimpleCov https://github.com/colszowka/simplecov-html
# initial version of test pulled into Coverband from Simplecov 12/19/2018
####
describe Coverband::Utils::FileList 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]
    }
    Coverband::Utils::Result.new(original_result).files
  end

  it 'has 11 covered lines' do
    assert_equal 11, subject.covered_lines
  end

  it 'has 3 missed lines' do
    assert_equal 3, subject.missed_lines
  end

  it 'has 17 never lines' do
    assert_equal 17, subject.never_lines
  end

  it 'has 14 lines of code' do
    assert_equal 14, subject.lines_of_code
  end

  it 'has 5 skipped lines' do
    assert_equal 5, subject.skipped_lines
  end

  it 'has the correct covered percent' do
    assert_equal 78.57142857142857, subject.covered_percent
  end

  it 'has the correct covered percentages' do
    assert_equal [50.0, 80.0, 100.0], subject.covered_percentages
  end

  it 'has the correct least covered file' do
    assert subject.least_covered_file.match(/sample_controller.rb/)
  end

  it 'has the correct covered strength' do
    assert_equal 0.9285714285714286, subject.covered_strength
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
coverband-4.2.0 test/coverband/utils/file_list_test.rb
coverband-4.2.0.rc3 test/coverband/utils/file_list_test.rb
coverband-4.2.0.rc2 test/coverband/utils/file_list_test.rb
coverband-4.1.1 test/coverband/utils/file_list_test.rb
coverband-4.2.0.rc1 test/coverband/utils/file_list_test.rb
coverband-4.1.0 test/unit/utils/file_list_test.rb
coverband-4.1.0.beta test/unit/utils/file_list_test.rb
coverband-4.2.0.beta test/unit/utils/file_list_test.rb
coverband-4.2.0.alpha test/unit/utils/file_list_test.rb