simplecov-small-badge 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7bd5b6b9a5569875b9fe95d181f63b32a9cf742d0ff26f6e2082fc9437abf9c
|
4
|
+
data.tar.gz: 44ad2758219eb48ead4fb2bb75d4a42c1ff8184291f4673f6d7959508c36b7d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456fea795c5468308737242c4103387042c39ecde8c7ac5ebc2c6b8236601894750934e4ecd08b3860f6ca715e1c44266c724e38bb58ce124f08a7bad33e4896
|
7
|
+
data.tar.gz: '08aae60fd42146dacaf3ca6928778a370c6baa43c8bcdc7e868ad69b3068d6d5bb3830432c20c358577affc793a0feed8bcf21ab2e66c416000e4fa1b7257b43'
|
@@ -7,13 +7,6 @@ describe SimpleCovSmallBadge::Formatter do
|
|
7
7
|
|
8
8
|
describe '#format' do
|
9
9
|
context 'bad result' do
|
10
|
-
it do
|
11
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(90)
|
12
|
-
mock_repo_badge_image(cov: '50%', state: 'bad')
|
13
|
-
result = mock_result(50)
|
14
|
-
expect(subject.format(result)).to be_truthy
|
15
|
-
end
|
16
|
-
|
17
10
|
it do
|
18
11
|
allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 90)
|
19
12
|
mock_repo_badge_image(cov: '50%', state: 'bad')
|
@@ -23,26 +16,6 @@ describe SimpleCovSmallBadge::Formatter do
|
|
23
16
|
end
|
24
17
|
|
25
18
|
context 'good result' do
|
26
|
-
it do
|
27
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(100)
|
28
|
-
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
29
|
-
cov: '100%')
|
30
|
-
mock_repo_badge_image(title: 'library', name: 'library',
|
31
|
-
cov: '100%', mock: image_mock)
|
32
|
-
result = mock_result(100, 'library' => mock_result_group(100))
|
33
|
-
expect(subject.format(result)).to be_truthy
|
34
|
-
end
|
35
|
-
|
36
|
-
it do
|
37
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(90)
|
38
|
-
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
39
|
-
cov: '90%')
|
40
|
-
mock_repo_badge_image(title: 'library', name: 'library',
|
41
|
-
cov: '90%', mock: image_mock)
|
42
|
-
result = mock_result(90, 'library' => mock_result_group(90))
|
43
|
-
expect(subject.format(result)).to be_truthy
|
44
|
-
end
|
45
|
-
|
46
19
|
it do
|
47
20
|
allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 100)
|
48
21
|
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
@@ -65,16 +38,6 @@ describe SimpleCovSmallBadge::Formatter do
|
|
65
38
|
end
|
66
39
|
|
67
40
|
context 'bad result' do
|
68
|
-
it do
|
69
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(91)
|
70
|
-
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
71
|
-
cov: '90%', state: 'bad')
|
72
|
-
mock_repo_badge_image(title: 'library', name: 'library',
|
73
|
-
cov: '90%', state: 'bad', mock: image_mock)
|
74
|
-
result = mock_result(90, 'library' => mock_result_group(90))
|
75
|
-
expect(subject.format(result)).to be_truthy
|
76
|
-
end
|
77
|
-
|
78
41
|
it do
|
79
42
|
allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 91)
|
80
43
|
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
@@ -87,16 +50,6 @@ describe SimpleCovSmallBadge::Formatter do
|
|
87
50
|
end
|
88
51
|
|
89
52
|
context 'unknown result' do
|
90
|
-
it do
|
91
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(nil)
|
92
|
-
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
93
|
-
cov: '90%', state: 'unknown')
|
94
|
-
mock_repo_badge_image(title: 'library', name: 'library',
|
95
|
-
cov: '90%', state: 'unknown', mock: image_mock)
|
96
|
-
result = mock_result(90, 'library' => mock_result_group(90))
|
97
|
-
expect(subject.format(result)).to be_truthy
|
98
|
-
end
|
99
|
-
|
100
53
|
it do
|
101
54
|
allow(SimpleCov).to receive(:minimum_coverage).and_return({})
|
102
55
|
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
@@ -110,7 +63,7 @@ describe SimpleCovSmallBadge::Formatter do
|
|
110
63
|
|
111
64
|
context 'mixed result' do
|
112
65
|
it do
|
113
|
-
allow(SimpleCov).to receive(:minimum_coverage).and_return(90)
|
66
|
+
allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 90)
|
114
67
|
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
115
68
|
cov: '89%', state: 'bad')
|
116
69
|
mock_repo_badge_image(title: 'library', name: 'library',
|
@@ -118,15 +71,129 @@ describe SimpleCovSmallBadge::Formatter do
|
|
118
71
|
result = mock_result(89, 'library' => mock_result_group(90))
|
119
72
|
expect(subject.format(result)).to be_truthy
|
120
73
|
end
|
74
|
+
end
|
121
75
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
76
|
+
context 'with branch coverage' do
|
77
|
+
before do
|
78
|
+
SimpleCov.enable_coverage :branch
|
79
|
+
SimpleCov.primary_coverage :branch
|
80
|
+
allow(SimpleCov).to receive(:minimum_coverage)
|
81
|
+
.and_return(minimum_coverage)
|
82
|
+
end
|
83
|
+
|
84
|
+
after do
|
85
|
+
SimpleCov.clear_coverage_criteria
|
86
|
+
SimpleCov.enable_coverage :line
|
87
|
+
SimpleCov.primary_coverage :line
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'when coverage is lower than required' do
|
91
|
+
let(:minimum_coverage) { { branch: 90, line: 100 } }
|
92
|
+
let(:coverage) { 50 }
|
93
|
+
let(:expected_state) { 'bad' }
|
94
|
+
|
95
|
+
it 'is bad' do
|
96
|
+
mock_repo_badge_image(cov: "#{coverage}%", state: expected_state)
|
97
|
+
result = mock_result(coverage)
|
98
|
+
subject.format(result)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'when coverage is lower than required with groups' do
|
103
|
+
let(:minimum_coverage) { { branch: 91, line: 100 } }
|
104
|
+
let(:coverage) { 90 }
|
105
|
+
let(:expected_state) { 'bad' }
|
106
|
+
|
107
|
+
it 'is bad' do
|
108
|
+
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
109
|
+
cov: "#{coverage}%",
|
110
|
+
state: expected_state)
|
111
|
+
mock_repo_badge_image(title: 'library', name: 'library',
|
112
|
+
cov: "#{coverage}%", state: expected_state,
|
113
|
+
mock: image_mock)
|
114
|
+
result = mock_result(coverage,
|
115
|
+
'library' => mock_result_group(coverage))
|
116
|
+
subject.format(result)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'when coverage is greater than or equal to that required' do
|
121
|
+
let(:minimum_coverage) { { branch: 100, line: 10 } }
|
122
|
+
let(:coverage) { 100 }
|
123
|
+
let(:expected_state) { 'good' }
|
124
|
+
|
125
|
+
it 'is good' do
|
126
|
+
mock_repo_badge_image(cov: '100%', state: expected_state)
|
127
|
+
result = mock_result(coverage)
|
128
|
+
subject.format(result)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when coverage is greater than or equal to that required with groups' do
|
133
|
+
let(:minimum_coverage) { { branch: 100, line: 10 } }
|
134
|
+
let(:coverage) { 100 }
|
135
|
+
let(:expected_state) { 'good' }
|
136
|
+
|
137
|
+
it 'is good' do
|
138
|
+
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
139
|
+
cov: "#{coverage}%")
|
140
|
+
mock_repo_badge_image(title: 'library', name: 'library',
|
141
|
+
cov: "#{coverage}%", mock: image_mock)
|
142
|
+
result = mock_result(coverage, 'library' => mock_result_group(coverage))
|
143
|
+
subject.format(result)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when minimum coverage is not set' do
|
148
|
+
let(:minimum_coverage) { {} }
|
149
|
+
let(:coverage) { 90 }
|
150
|
+
let(:expected_state) { 'unknown' }
|
151
|
+
|
152
|
+
it 'is unknown' do
|
153
|
+
mock_repo_badge_image(cov: "#{coverage}%",
|
154
|
+
state: expected_state)
|
155
|
+
result = mock_result(coverage)
|
156
|
+
expect(subject.format(result)).to be_truthy
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'when minimum coverage is not set with groups' do
|
161
|
+
let(:minimum_coverage) { {} }
|
162
|
+
let(:coverage) { 90 }
|
163
|
+
let(:expected_state) { 'unknown' }
|
164
|
+
|
165
|
+
it 'is unknown' do
|
166
|
+
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
167
|
+
cov: "#{coverage}%",
|
168
|
+
state: expected_state)
|
169
|
+
mock_repo_badge_image(title: 'library', name: 'library',
|
170
|
+
cov: "#{coverage}%", state: expected_state,
|
171
|
+
mock: image_mock)
|
172
|
+
result = mock_result(coverage,
|
173
|
+
'library' => mock_result_group(coverage))
|
174
|
+
expect(subject.format(result)).to be_truthy
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
context 'when global coverage is lower but group coverage is as required' do
|
179
|
+
let(:minimum_coverage) { { branch: 90, line: 10 } }
|
180
|
+
let(:global_coverage) { 89 }
|
181
|
+
let(:group_coverage) { 90 }
|
182
|
+
let(:global_state) { 'bad' }
|
183
|
+
let(:group_state) { 'good' }
|
184
|
+
|
185
|
+
it 'is mixed' do
|
186
|
+
image_mock = mock_repo_badge_image(title: 'total', name: 'total',
|
187
|
+
cov: "#{global_coverage}%",
|
188
|
+
state: global_state)
|
189
|
+
mock_repo_badge_image(title: 'library', name: 'library',
|
190
|
+
cov: "#{group_coverage}%",
|
191
|
+
state: group_state,
|
192
|
+
mock: image_mock)
|
193
|
+
result = mock_result(global_coverage,
|
194
|
+
'library' => mock_result_group(group_coverage))
|
195
|
+
subject.format(result)
|
196
|
+
end
|
130
197
|
end
|
131
198
|
end
|
132
199
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-small-badge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Grimme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: repo-small-badge
|