-
Notifications
You must be signed in to change notification settings - Fork 564
/
Copy pathconfiguration_spec.rb
74 lines (60 loc) · 1.88 KB
/
configuration_spec.rb
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# frozen_string_literal: true
require "helper"
describe SimpleCov::Configuration do
let(:config_class) do
Class.new do
include SimpleCov::Configuration
end
end
let(:config) { config_class.new }
describe "#print_error_status" do
subject { config.print_error_status }
context "when not manually set" do
it { is_expected.to be true }
end
context "when manually set" do
before { config.print_error_status = false }
it { is_expected.to be false }
end
end
describe "#tracked_files" do
context "when configured" do
let(:glob) { "{app,lib}/**/*.rb" }
before { config.track_files(glob) }
it "returns the configured glob" do
expect(config.tracked_files).to eq glob
end
context "and configured again with nil" do
before { config.track_files(nil) }
it "returns nil" do
expect(config.tracked_files).to be_nil
end
end
end
context "when unconfigured" do
it "returns nil" do
expect(config.tracked_files).to be_nil
end
end
describe "#minimum_coverage" do
it "does not warn you about your usage" do
expect(config).not_to receive(:warn)
config.minimum_coverage(100.00)
end
it "warns you about your usage" do
expect(config).to receive(:warn).with("The coverage you set for minimum_coverage is greater than 100%")
config.minimum_coverage(100.01)
end
end
describe "minimum_coverage_by_file" do
it "does not warn you about your usage" do
expect(config).not_to receive(:warn)
config.minimum_coverage_by_file(100.00)
end
it "warns you about your usage" do
expect(config).to receive(:warn).with("The coverage you set for minimum_coverage_by_file is greater than 100%")
config.minimum_coverage_by_file(100.01)
end
end
end
end