File: minimum_coverage_by_file_check_spec.rb

package info (click to toggle)
ruby-simplecov 0.22.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,512 kB
  • sloc: ruby: 5,550; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require "helper"

RSpec.describe SimpleCov::ExitCodes::MinimumCoverageByFileCheck do
  let(:result) do
    instance_double(SimpleCov::Result, coverage_statistics_by_file: stats)
  end
  let(:stats) do
    {
      line: [SimpleCov::CoverageStatistics.new(covered: 8, missed: 2)]
    }
  end

  subject { described_class.new(result, minimum_coverage_by_file) }

  context "all files passing requirements" do
    let(:minimum_coverage_by_file) { {line: 80} }

    it { is_expected.not_to be_failing }
  end

  context "one file violating requirements" do
    let(:minimum_coverage_by_file) { {line: 90} }

    it { is_expected.to be_failing }
  end
end